Microsoft Office Tutorials and References
In Depth Information
Creating the Option Button controls
Figure 7-16: This application uses a variety of techniques to plot monthly
climate data for two selected U.S. cities.
Creating the Option Button controls
I needed a way to allow the user to select the data to plot and decided to use Option
Button controls from the Forms toolbar. Because option buttons work as a group,
the four Option Button controls are all linked to the same cell (cell O3). Cell O3,
therefore, contains a value from 1 to 4, depending on which option button is
selected.
I needed a way to obtain the name of the data table based on the numeric value
in cell O3. The solution was to write a formula (in cell O4) that uses Excel’s CHOOSE
function:
=CHOOSE(O3,”TemperatureData”,”PrecipitationData”,”SunshineData”,”WindData”)
Therefore, cell O4 displays the name of one of the four named data tables. I then did
some cell formatting behind the Option Button controls to make them more visible.
Creating the city lists
Next step in setting up the application: Create drop-down lists to enable the user to
choose the cities to be compared in the chart. Excel’s Data Validation feature makes
creating a drop-down list in a cell very easy. First, I did some cell merging to create
a wider field. I merged cells J11:M11 for the first city list and gave them the name
City1 . I merged cells J13:M13 for the second city list and gave them the name City2 .
To make working with the list of cities easier, I created a named range, CityList ,
which refers to the first column in the PrecipitationData table.
Search JabSto ::




Custom Search