Using Indirect function in Data Validation through VBA

前端 未结 1 869
长发绾君心
长发绾君心 2020-12-21 22:11

I am using the indirect function in my excel sheet through VBA , I am getting an error when I try to substitute the cell address in.

=indirect(F5)

相关标签:
1条回答
  • 2020-12-21 22:31

    Using a range

    With Selection.Validation
        .Delete
        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
        xlBetween, Formula1:="=INDIRECT(""" & Range("F5").Address(False, False) & """)"
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputTitle = ""
        .ErrorTitle = ""
        .InputMessage = ""
        .ErrorMessage = ""
        .ShowInput = True
        .ShowError = True
    End With
    
    0 讨论(0)
提交回复
热议问题