Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call Procedure Ronbo Excel Programming 4 February 23rd 05 08:11 PM
Where else to look for procedure call Lulu Excel Programming 0 November 24th 04 03:07 PM
Where else to look for procedure call Lulu Excel Programming 2 November 24th 04 02:14 AM
can I call a procedure using a variable Santiago Gomez Excel Programming 8 December 24th 03 09:08 PM
procedure won't call John Gittins Excel Programming 0 August 5th 03 08:17 PM


All times are GMT +1. The time now is 10:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"