This should be simple... but I'm missing something.
Imagine two buttons on a form.
When you click either button you want the same MACRO to run, but do slightly different tasks. (Different range, different color, etc.)
You install a variable called "mydata" and if it has a value of "1" it will behave one way, if "2" it will behave another.
For now... let's just put this value into cell "B3"... just so I can see that the data is actually passed.
I thought that I could just change the routine to![]()
Sub DO_SOMETHING() Dim myinfo As String Range("B3").Select ActiveCell.FormulaR1C1 = myinfo Range("A1").Select End Sub
But if I do... when I try to assign it to a button...![]()
Sub DO_SOMETHING_ELSE(myinfo) Dim myinfo As String Range("B3").Select ActiveCell.FormulaR1C1 = myinfo Range("A1").Select End Sub
BUTTON 1 would call DO_SOMETHING_ELSE("1")
...OR...
BUTTON 2 would call DO_SOMETHING_ELSE("2")
It say's it's too complex.
I can call WORKBOOK!DO_SOMETHING just fine... but if I add the data field... FAIL.
So...
How do I call DO_SOMETHING and pass the variable... or call DO_SOMETHING_ELSE(data) ?
Thanks,
Jerry
Bookmarks