Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Assign Sub Name to a Variable

If a string variable "ProductName" can have one of 10 values assigned
to it, is it possible to call a subroutine whose name is the same as
the value of the variable?? If so, can you supply an example please.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Assign Sub Name to a Variable

Hi Alan,

Not that I'm aware of, but you could pass the variable instead?........

Sub FirstProcedure()
Dim ProductName As String
Call ProcessingProcedure(ProductName)
End Sub

Sub ProcessingProcedure(ByVal ProductName As String)
Select Case ProductName
Case "Cat"
'Code here
Case "Dog"
'Code here
Case "Mouse"
'Code here
Case Else
'Code here
End Select
End Sub

Hope that helps

Best regards

John



"Alan" wrote in message
ups.com...
If a string variable "ProductName" can have one of 10 values assigned
to it, is it possible to call a subroutine whose name is the same as
the value of the variable?? If so, can you supply an example please.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Assign Sub Name to a Variable

Application.Run ProductName

--
HTH

Bob Phillips

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

"Alan" wrote in message
ups.com...
If a string variable "ProductName" can have one of 10 values assigned
to it, is it possible to call a subroutine whose name is the same as
the value of the variable?? If so, can you supply an example please.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Assign Sub Name to a Variable

Thanks guys.

Bob Phillips wrote:
Application.Run ProductName

--
HTH

Bob Phillips

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

"Alan" wrote in message
ups.com...
If a string variable "ProductName" can have one of 10 values assigned
to it, is it possible to call a subroutine whose name is the same as
the value of the variable?? If so, can you supply an example please.


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
Assign value to a variable name Gnarlodious Excel Discussion (Misc queries) 2 August 20th 06 07:10 AM
Assign value to variable rroach Excel Discussion (Misc queries) 1 July 13th 05 05:24 AM
Variable VB to assign new sheet name Kevin M Excel Worksheet Functions 0 June 17th 05 12:15 AM
assign variable Tim Excel Programming 10 October 1st 04 07:33 PM
Assign Formula to Variable James Stephens Excel Programming 3 February 26th 04 04:16 PM


All times are GMT +1. The time now is 09:19 AM.

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

About Us

"It's about Microsoft Excel"