MeisterConrad
New Member
- Joined
- Jan 17, 2017
- Messages
- 42
- Office Version
- 2007
I have some code for dependent drop-down menus in two columns.
I've included one of the failed versions of the code (as comment lines) as well (I would rather refer to the independent column by ("Table" & n & "[Budget Category]") method).
None of it works.
However, I found that if I make a macro of the data-validation process, I get the error message about "currently evaluates to an error". The error message also asks if I want to continue, TO WHICH I ANSWER "YES". But there is no code in the resulting macro that answers "yes" to the error.
I'm guessing that all my attempts at code are erroring because there is no data yet in the independent column.
Is there some sort of code that will work around this as if it were "answering yes" to the "wanting to continue"?
VBA Code:
Range("Table" & n & "[Budget Category]").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=BudgetingCategoriesList"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Range("H11").Select
With Selection.Validation
On Error Resume Next
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=INDIRECT(G11)"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Selection.AutoFill Destination:=Range("Table7[Budget Sub-Category]"), Type _
:=xlFillDefault
Range("Table7[Budget Sub-Category]").Select
' Range("Table" & n & "[Budget Sub-Category]").Select
' With Selection.Validation
' .Delete
' .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=INDIRECT(" & Range("Table" & n & "[Budget Category]") & ")"
' .IgnoreBlank = True
' .InCellDropdown = True
' .InputTitle = ""
' .ErrorTitle = ""
' .InputMessage = ""
' .ErrorMessage = ""
' .ShowInput = True
' .ShowError = True
' End With
I've included one of the failed versions of the code (as comment lines) as well (I would rather refer to the independent column by ("Table" & n & "[Budget Category]") method).
None of it works.
However, I found that if I make a macro of the data-validation process, I get the error message about "currently evaluates to an error". The error message also asks if I want to continue, TO WHICH I ANSWER "YES". But there is no code in the resulting macro that answers "yes" to the error.
I'm guessing that all my attempts at code are erroring because there is no data yet in the independent column.
Is there some sort of code that will work around this as if it were "answering yes" to the "wanting to continue"?