Archive of Mr Excel Message Board

Back to Excel VBA archive index
Back to archive home

Activating macro from cell text
Posted by Peter C on February 22, 2001 1:40 PM
A number of my macros use a large amount of If statements, particularly for month related functions, ie, Update_Jan, Update_Feb, etc. Can a macro be run from reading text in a cell,eg Update_Oct and it runs the "Update_Oct" macro without having to use twelve different If statements in VB?
I Hope this makes sense, thanks.

| Check out our Excel VBA Resources
|
 |
 |
 |
 |
 |
Re: Activating macro from cell text
Posted by David Hawley on February 22, 2001 8:39 PM
Hi peter
It sure can:
Sub TryThis()
Dim MyMacro As String
[A1] = "Hello"
MyMacro = [A1]
Run MyMacro
End Sub
Sub Hello()
MsgBox "Hello"
End Sub
Dave
OzGrid Business Applications

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our
online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.