VBA: Validate List settings

Posted by stanigator on Stack Overflow See other posts from Stack Overflow or by stanigator
Published on 2010-05-11T05:05:30Z Indexed on 2010/05/11 5:34 UTC
Read the original article Hit count: 158

Filed under:
|
|
|
Sub Macro1()
'
' Macro1 Macro
'

'
    Worksheets("Drop-down").Select
    For i = 1 To 10
        ActiveSheet.Cells(i, 2).Select
        With Selection.Validation
            .Delete
            ' Error in this line
            .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
            xlBetween, Formula1:=Range(Worksheets("Misc").Cells(2, i), Worksheets("Misc").Cells(2, i).End)
            .IgnoreBlank = True
            .InCellDropdown = True
            .InputTitle = ""
            .ErrorTitle = ""
            .InputMessage = ""
            .ErrorMessage = ""
            .ShowInput = True
            .ShowError = True
        End With
    Next i
End Sub

I'm getting an error in the line below the comment, yet I don't know how to fix it. It would be great to hear some suggestions. Thanks in advance!

© Stack Overflow or respective owner

Related posts about vba

Related posts about excel-vba