demonfreak
New Member
- Joined
- Dec 11, 2016
- Messages
- 12
i'm needing help with a macro I'm trying to create to save me some time on creating dependent data validations.
So it looks like the macro I created works with a normal named range but when I use the formula "indirect" it's giving an error, if I enter in any other named range i don't get the error, this wouldn't work because it needs to be a depending data validation drop list.
Any help will be appreciated.
Thanks in Advance!
So it looks like the macro I created works with a normal named range but when I use the formula "indirect" it's giving an error, if I enter in any other named range i don't get the error, this wouldn't work because it needs to be a depending data validation drop list.
Any help will be appreciated.
Code:
Sheets("D2D").Select
Range("AG2").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=Error"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Range("AH2").Select
With Selection.Validation
.Delete
[B][COLOR=#ff0000]'THIS IS WHERE THE ERROR IS[/COLOR][/B]
[B] .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _[/B]
[B] xlBetween, Formula1:="=INDIRECT(AG2)"[/B]
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Range("AI2").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=INDIRECT(AH2)"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Thanks in Advance!