我试图间接引用VBA中的列表但仍然遇到运行时错误1004.
我需要在下面定义的范围中添加数据验证,它将查看上一列中单元格的值,以确定要显示的列表。
非常感谢任何帮助。
Range("Q2:Q" & LastRow).Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=INDIRECT(RC[-1])"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
NB我也尝试过了;
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=INDIRECT($P2)"