Forum Discussion
Creating a default value from drop down list
- Jan 15, 2020
You could have the validated cell point at the first cell in the list. Suppose your list populating the dropdown starts at A6, you could enter:
=$A$6....in each cell that requires validation. Example attached.
You could have the validated cell point at the first cell in the list. Suppose your list populating the dropdown starts at A6, you could enter:
=$A$6....in each cell that requires validation. Example attached.
- jefortMar 05, 2021Copper Contributor
- Riny_van_EekelenMar 05, 2021Platinum Contributor
jefort You'll need a small piece of VBA in the worksheet code for that. Now, I'm not a VBA expert, so I just picked-up an example from the web https://www.automateexcel.com/vba/worksheet-change-event/ and adapted it to your schedule.
I have also added some formulae (in columns P and Q) that will work if you are on a modern Excel version that supports the use of UNIQUE and FILTER. Two functions that will be much easier to write, understand and maintain than what you currently have in column M.
Now, if you prefer not to download and open a macro enabled workbook, follow the instructions in the above-mentioned link and paste the following code in the code area for Sheet1.
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$G$7" Then Range("G8").Formula = "=M7" End If End Sub- jefortMar 12, 2021Copper ContributorWhat if I have TWO If-Then statements to run for one sheet. How should I do this. For instance:
If Target.Address = "$E$10" Then
Range("W10").Formula = "=I5"
End If
If Target.Address = "'$H$4" Then
Range("AO10").Formula = "=K4"
End If
- jefortMar 05, 2021Copper ContributorIf changes are made in the validated cell, the formula will be lost. What if changes are made in the source list and I want that the first value from the list would still be the default value in the validated cell?
- JimS-2145Jan 15, 2020Copper Contributor
Riny_van_Eekelen Thank you. Simple and effective. One more question you may know. How do I get this to persist as I add rows with new customers?
- Riny_van_EekelenJan 15, 2020Platinum Contributor
Not sure I follow. You mean that you want to expand the range that populates the drop down?
- JimS-2145Jan 15, 2020Copper Contributor
Riny_van_Eekelen I have a long list of customers. I was successfully able to add your solution to the existing rows. Thank you! The challenge I am having now is when I add a new row/customer to my list, which is in table format. The =$A$6 doesn't copy into the cell when I add the new row. I realize this is an issue unrelated to the initial question, but something I will need to solve. Thanks.