ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling a sub method (https://www.excelbanter.com/excel-programming/363531-calling-sub-method.html)

richcoleuk[_5_]

Calling a sub method
 

Hi,

I have the name of my sub method stored in a variable:

mySubMethodName = "do_something"

I then want to call this method using the variable, I have tried
the following but it doesn't work:

Call mySubMethodName

Is there anyway to do what I am trying to do?


--
richcoleuk
------------------------------------------------------------------------
richcoleuk's Profile: http://www.excelforum.com/member.php...o&userid=33103
View this thread: http://www.excelforum.com/showthread...hreadid=549375


Christian[_8_]

Calling a sub method
 

richcoleuk wrote:
Hi,

I have the name of my sub method stored in a variable:

mySubMethodName = "do_something"

I then want to call this method using the variable, I have tried
the following but it doesn't work:

Call mySubMethodName

Is there anyway to do what I am trying to do?


--
richcoleuk
------------------------------------------------------------------------
richcoleuk's Profile: http://www.excelforum.com/member.php...o&userid=33103
View this thread: http://www.excelforum.com/showthread...hreadid=549375



Why don't you just use

Call do_something

Christian


richcoleuk[_6_]

Calling a sub method
 

because the name of the sub method is specified on the worksheet, and
this value is taken from the sheet.


--
richcoleuk
------------------------------------------------------------------------
richcoleuk's Profile: http://www.excelforum.com/member.php...o&userid=33103
View this thread: http://www.excelforum.com/showthread...hreadid=549375


NickHK

Calling a sub method
 
richcoleuk,
Application.Run ?

NickHK

"richcoleuk" wrote
in message ...

Hi,

I have the name of my sub method stored in a variable:

mySubMethodName = "do_something"

I then want to call this method using the variable, I have tried
the following but it doesn't work:

Call mySubMethodName

Is there anyway to do what I am trying to do?


--
richcoleuk
------------------------------------------------------------------------
richcoleuk's Profile:

http://www.excelforum.com/member.php...o&userid=33103
View this thread: http://www.excelforum.com/showthread...hreadid=549375




Bob Phillips

Calling a sub method
 
Application.Run variable_name

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"richcoleuk" wrote
in message ...

because the name of the sub method is specified on the worksheet, and
this value is taken from the sheet.


--
richcoleuk
------------------------------------------------------------------------
richcoleuk's Profile:

http://www.excelforum.com/member.php...o&userid=33103
View this thread: http://www.excelforum.com/showthread...hreadid=549375




richcoleuk[_7_]

Calling a sub method
 

Works a charm, thanks Nic

--
richcoleu
-----------------------------------------------------------------------
richcoleuk's Profile: http://www.excelforum.com/member.php...fo&userid=3310
View this thread: http://www.excelforum.com/showthread.php?threadid=54937



All times are GMT +1. The time now is 04:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com