

- How to make a drop down list in excel from another sheet update#
- How to make a drop down list in excel from another sheet code#

The event handler executes when the user makes changes to the sheet with the source data:įlagProgram determines if the current changes made to the sheet have been done by the program or the user. The main function is Worksheet_Change event handler. Operator:= xlBetween, Formula1:=strSourceRange Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _ StrSourceRange = "= Sheet1!A1:A" + Strings.Trim(Str(intRow)) 'the reference string to the source range Private Sub Update_DataValidation( ByVal intRow As Integer) 'based on the number of rows provided by the input 'the function below updates the source range for the data validation 'if there is no more data left stop the loop 'determines if the we have reached the end 'This function will return the total count of rows in the 'update the drop down list(data validation) Private Sub Worksheet_Change( ByVal Target As Range) The highlighted parts must be changed based on the location of your source data and the location you would like the drop down list to appear:
How to make a drop down list in excel from another sheet code#
The code below must be copied to the sheet with the source data.
How to make a drop down list in excel from another sheet update#
Step 2: In the next step we need to update the drop down list to accommodate for the changes made in its source. Again the first step would be to modify the source data:


Or for example lets say we want to remove “item 4”. Again the first thing would be to modify the source data: Or for example lets say we want to add an item to the list of items. For example lets say we want to modify the second item to “New Item 2”, we would need to change the data validation’s source to the values below: Step 1: The first thing you would have to do is change the source data. In order to modify, add, insert and remove items from a drop down list created using data validation, you would have to follow 2 steps. Modifying, Adding, Inserting and Removing Items (Usin VBA): The name of the sheet is Sheet1″.Īfter pressing Ok your drop down list is ready: Note: I this example the input data is in another sheet. If they are in separate sheets you would use a statement like “=SheetName!A1:A6”, where “SheetName” is replaced with the name of the sheet. If the drop down list (data validation) and the data are in the same sheet you would reference them using a statement like “=A1:A6”. Then click on the Data Validation button on the Data Ribbon: Step 2: Select the cell you would like to add the drop down list to. Usually I open a new sheet, name it something no one would ever consider using (like “far43fq”) and print the data there. Step1 : In the first step you would need to print the data you are going to fill the drop down list with somewhere.
