I am trying to create a drop down list for every cell in a column starting from a specific cell. The following is what I have produced:
Public Sub Dropdown()
Dim dvList As String
dvList = "Option1, Option2, Option3"
With ActiveSheet.Range("C25").Resize(50, 1).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula:=dvList
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub
I am having an issue with this line:
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula:=dvList
When I run this code, I keep getting:
Run-time error '1004':
Application-defined or object-defined error
I don’t know why this is happening, it would appear this is the way to do it. Could someone please point out my error?
Try changing it to
Formula1:=dvList