Forum Discussion
Editable drop down list
If I may insert an additional option with VBA :)….
You can use VBA to create a dynamic drop-down list that changes based on the selected option.
You can use the Worksheet_Change event to trigger a macro that updates the drop-down list with the appropriate sizes when a stock description is selected.
Here’s an example of how you can do this (untested):
Private Sub Worksheet_Change(ByVal Target As Range)
' Check if the changed cell is the one containing the stock description
If Not Intersect(Target, Range("A1")) Is Nothing Then
' Clear the existing drop-down list
With Range("B1").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=""
End With
' Update the drop-down list with the appropriate sizes
Select Case Range("A1").Value
Case "Stock 1"
Range("B1").Validation.Formula1 = "Size 1,Size 2,Size 3"
Case "Stock 2"
Range("B1").Validation.Formula1 = "Size 4,Size 5,Size 6"
Case "Stock 3"
Range("B1").Validation.Formula1 = "Size 7,Size 8,Size 9"
End Select
End If
End SubIn this example, we assume that the stock description is selected from cell A1 and the sizes are displayed in a drop-down list in cell B1. When the value in cell A1 changes, the Worksheet_Change event is triggered and the macro checks if the changed cell is A1. If it is, it clears the existing drop-down list in cell B1 and updates it with the appropriate sizes based on the selected stock description.
You can modify this code to fit your specific needs by changing the cell references and adding more cases to handle different stock descriptions and their corresponding sizes.
Hope it helps!