I have a issue trying to make a dropdown list from specific data. What I need to do here is to make a dropdown list to categories A, B and C containing the cities that correspond to them as they are shown in column B
I tried my best but couldn't do that much to solve the code:
Sub AddData()
Dim AStr As String
Dim Value, Colum As Variant
For Colum = 7 to 10
If Sheets("Sheet1").Cells(Colum,2) = Sheets("Sheet1").Range("A:A")
Then
For Each Value In Range("B1:B" & Lrow)
AStr = AStr & "," & Value
Next Value
AStr = Right(AStr, Len(AStr) - 1)
With Worksheets("Sheet1").Cells("G3:I3").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=AStr
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
Next
End Sub
If anyone know how to figure out this, I will thank you very much!
