VARIABLES AGAIN
I have a problem with string variables:
I have created this button in an Excel sheet to which I have attached a Macro.
When I bring out the Programming code, it shows projects and modules. The
real program is in the module and it is called by an expression Call Macro1
found in the projects section of the spreadsheet.
I am creating about 40 Macro buttons which will have to do the same
procedure but with 2 different variables changing with every button. These
are string variables.
Thus far I have done the following:
In the Project sheet these are my lines:
Private Sub CommandButton1_Click()
S$ = "7A"
N$ = "B3"
Call Macro1
End Sub
In the Macro (in the module the procedure), I have used the following
lines:
Sheets(S$).Select
Range(N$).Select
But it gives me an error while executing.
I have tried putting the variable assignments in the same Macro1, and it
works. But that doesnt solve anything for me.
As I guess it, the variable values are not passing from the Project sheet to
the Macro.
I have even tried to use another Macro2 and place my variable assignments
there. Calling Macro2 first and then Macro1. It still doesnt work.
Any solution to this problem? I am in a hurry guys.
Please Help. I am new to this.
Regards.
|