Validation data list problem

Karlbirger

Board Regular
Joined
Sep 21, 2011
Messages
68
Hi guys

Got debugger (bolded text) when I run this code which I have recorded:

Code:
Range("J6").Select
    With Selection.Validation
        .Delete
[B]       .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _[/B]
[B]       xlBetween, Formula1:="=INDIRECT(I6)"[/B]
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputTitle = ""
        .ErrorTitle = ""
        .InputMessage = ""
        .ErrorMessage = ""
        .ShowInput = True
        .ShowError = True
    End With

Got Windows Vista and Excel 2007. Anyone have had any similar problem or knows what could be wrong with the code?
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Have you tried selecting something from the dropdown in I6 before running your macro (assuming there is one of course)?
 
Upvote 0
It's a validation data list in I6 called Asset, containing three possible selections; Real_estate, Energy, or Other.

At the time I create the INDIRECT(I6) validation list the validation list in I6 is created, but has no info/value choosen in the cell yet.
 
Upvote 0
The code will fail if Excel can't evaluate the formula:

=INDIRECT(I6)

so one of the items in the dropdown in I6 must be selected and that must be a named range.
 
Upvote 0
As far as I know I can't select one of the alternatives in I6 roll dowh list by macro, and it shouldn't be an issue for creating =INDIRECT(I6).

But if this is the issue, how do I choose one of the values in I6 through vba?
 
Upvote 0

Forum statistics

Threads
1,224,543
Messages
6,179,429
Members
452,914
Latest member
echoix

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