![]()
Home Excel Tips Sample Spreadsheets
Refer to a Source List on a Different WorksheetWhen you try to create a data validation dropdown list, and refer to a source list on a different worksheet, you may see an error message: "You may not use references to other worksheets of workbooks for Data Validation criteria."
To avoid this problem, name the list on the other worksheet, then refer to the named range, as described here: Data Validation
If the list is in a different workbook, you can use the technique described here: Use a List from Another Workbook
Some lists change frequently, with items being added or removed. If the list is the source for a Data Validation dropdown, use a dynamic formula to name the range, and the dropdown list will be automatically updated.
For instructions, view this page: Create a Dynamic Range
Data Validation Dropdowns and Change EventsIn Excel 2000 and later versions, selecting an item from a Data Validation dropdown list will trigger a Change event. This means that code can automatically run after a user selects an item from the list.
To see an example, go to the Sample Worksheets page, and under the Filters heading, find Product List by Category, and download the ProductsList.zip file.
In Excel 97, selecting an item from a Data Validation dropdown list does not trigger a Change event, unless the list items have been typed in the Data Validation dialog box. In this version, you can add a button to the worksheet, and run the code by clicking the button. To see an example, go to the Sample Worksheets page, and under the Filters heading, find Product List by Category, and download the ProductsList97.zip file.
Another option in Excel 97 is to use the Calculate event to run the code. To do this, refer to the cell with data validation in a formula on the worksheet, e.g. =MATCH(C3,CategoryList,0). Then, add the filter code to the worksheet's Calculate event. To see an example, go to the Sample Worksheets page, and under the Filters heading, find Product List by Category, and download the ProductsList97Calc.zip file.
Data Validation on a Protected SheetIn Excel 2000 and earlier versions, you can change the selection in a data validation dropdown, if the list is from a range on the worksheet. If the list is typed in the data validation dialog box, the selection can't be changed.
In Excel 2002 and later versions, neither type of dropdown list can be changed if the cell is locked and the sheet is protected.
This MSKB article has information on the previous behaviour:
XL97: Error When Using Validation Drop-Down List Box http://support.microsoft.com/default.aspx?id=157484
Data Validation Font Size and List LengthThe font size in a data validation list can't be changed, nor can its default list length, which has a maximum of eight rows.
If you reduce the zoom setting on a worksheet, it can be almost impossible to read the items in the dropdown list, as in the example at right.
One workaround is to use programming, and a combo box from the Control Toolbox, to overlay the cell with data validation. If the user double-clicks on a data validation cell, the combobox appears, and they can choose from it. There are instructions here.
![]()
Make the Dropdown List Appear LargerIn a Data Validation dropdown list, you can't change the font or font size.
To make the text appear larger, you can use an event procedure (three examples are shown below) to increase the zoom setting when the cell is selected. (Note: this can be a bit jumpy)
Or, you can use code to display a combobox, as described in the previous section.
Zoom in when specific cell is selected
If cell A2 has a data validation list, the following code will change the zoom setting to 120% when that cell is selected.
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$A$2" Then ActiveWindow.Zoom = 120 Else ActiveWindow.Zoom = 100 End If End SubTo add this code to the worksheet:
![]()
Home Excel Tips Sample Spreadsheets
Contextures contact information
Last updated: May 8, 2008 8:01 AM