Data Validation currently evaluates to an error. - Because no data yet! How to make go?

Status
Not open for further replies.

MeisterConrad

New Member
Joined
Jan 17, 2017
Messages
39
Office Version
  1. 2007
I have some code for dependent drop-down menus in two columns.

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"?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Status
Not open for further replies.

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top