We help IT Professionals succeed at work.

Multiple criteria from two data validation lists sets trigger for macro

biker9
biker9 asked
on
Hello Experts,
I need a bit of code that will select a macro based upon user selection from two data validation lists, each list contains 4 choices. The macro is triggered upon a button click.
Thanks,
biker9 Criteria-sets-macro.xlsm
Comment
Watch Question

Top Expert 2008

Commented:
Problem with your macros is the system will confuse them for cell names, etc. If you rename them, you can use the application.run.

Here is my update

Sub Button3_Click()

Application.Run "Macro" & [G11] & [G12]

End Sub

Sub MacroA1()

Range("G21") = "Test A1 OK"

End Sub


Sub MacroB1()

Range("G21") = "Test B1 OK"

End Sub

Open in new window


Thomas

Author

Commented:
Thomas,
when I run the code, I get an error msg "400" ?
tx,
Ray
Top Expert 2008

Commented:
Are you running it from personal.xls or the workbook where the button is?
Top Expert 2008

Commented:
Are your sheets protected?

Try it with the file I tested
Criteria-sets-macro.xlsm

Author

Commented:
I now get a run time error 1004 with the file you sent.
Top Expert 2008
Commented:
My bad. Try this one
Copy-of-Criteria-sets-macro.xlsm

Author

Commented:
Perfect,
Thanks Thomas,

(ps. sorry..i thought i had closed this off a couple days ago)
Top Expert 2008

Commented:
No problem. Glad to help.

Thomas