Drop-down cells
This sample covers applying a dropdown list to a cell. These supply the user with a choice of values based on a specified validation range.
You will learn
- How to apply and configure a dropdown list manually.
- How to apply and configure a dropdown list in user code.
Before you begin
Do one of the following to open the example workbook:
- In Windows, select Start, Resolver One, Samples, Drop-down cells.
- Download the file from the Resolver Exchange.
About the example workbook
The example workbook has three key components:
Cities worksheet
The Cities worksheet contains a small list of cities and their timezones relative to UTC (the timezone that used to be called GMT).
The worksheet uses header rows and columns so that the code can reference cells using meaningful names:
- Header column: The city column
- Header row: The row with the labels 'city' and 'timezone'.
Timezone Selector worksheet: adding dropdowns manually
The Timezone Selector worksheet has two important cells linked by a formula using a user code function:
- Cell B1
- Has a dropdown list populated with a list of cities from the validation range Cities!$A$2:$A$6. This prevents the passing of bad time values to B2.
- Cell B2
- Has the formula =timezone(B1).
- The timezone function
This is defined in the pre-constants user code. When called with a city name, it looks up and returns the appropriate value from the 'time' column on the 'cities' worksheet:
def timezone(city): cities = workbook['cities'] return cities['time', city]
To edit or apply a dropdown range
- Select the cell.
- Select Data, Dropdown and enter a validation range.
More on the validation range
Resolver One stores validation ranges as:
- Absolute references with dollar signs, like Cities!$A$2:$A$6 (but you don't need to type the dollar signs when you enter them, e.g. Cities!a2:a6 will work fine).
- Named ranges instead of a reference to an explicit cell range.
Comments
If you have comments, questions or suggestions about any of the Resolver One documentation, please post them to the Documentation Suggestions Forum.
