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.
Sub DO_SOMETHING()
Dim myinfo As String
Range("B3").Select
ActiveCell.FormulaR1C1 = myinfo
Range("A1").Select
End Sub
I thought that I could just change the routine to
Sub DO_SOMETHING_ELSE(myinfo)
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...
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.
WORKBOOK!DO_SOMETHING("1") for example... FAIL.
So...
How do I call DO_SOMETHING and pass the variable... or call DO_SOMETHING_ELSE(data) ?
So... if the user clicks BUTTON 1, the cell B3 will display "1"... if they click BUTTON 2, the cell should display "2".
Can you help me?
Thanks,
Jerry
Bookmarks