Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call procedure using variable
I need use an expression, which has been derived as a variable in a code
procedure, to call a Subroutine of the same name. The Sub Routine will have a name eg MyZ7 derived from:- MyName="My" & Range("A1").Value where A1 contains "Z7" this produces "MyZ7" OK but the problem is that if I now write:- "Call MyName" I get an error message "Compile Error expected Procedure not Variable" There must be a way around this: help please -- donwb |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call procedure using variable
One way:
application.run thisworkbook.name & "!" & myname Is Thisworkbook ok? donbowyer wrote: I need use an expression, which has been derived as a variable in a code procedure, to call a Subroutine of the same name. The Sub Routine will have a name eg MyZ7 derived from:- MyName="My" & Range("A1").Value where A1 contains "Z7" this produces "MyZ7" OK but the problem is that if I now write:- "Call MyName" I get an error message "Compile Error expected Procedure not Variable" There must be a way around this: help please -- donwb -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Call procedure using variable
Hi Dave
That works perfectly. Many thanks -- donwb "Dave Peterson" wrote: One way: application.run thisworkbook.name & "!" & myname Is Thisworkbook ok? donbowyer wrote: I need use an expression, which has been derived as a variable in a code procedure, to call a Subroutine of the same name. The Sub Routine will have a name eg MyZ7 derived from:- MyName="My" & Range("A1").Value where A1 contains "Z7" this produces "MyZ7" OK but the problem is that if I now write:- "Call MyName" I get an error message "Compile Error expected Procedure not Variable" There must be a way around this: help please -- donwb -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Call Procedure | Excel Programming | |||
Where else to look for procedure call | Excel Programming | |||
Where else to look for procedure call | Excel Programming | |||
can I call a procedure using a variable | Excel Programming | |||
procedure won't call | Excel Programming |