Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default run a macro from a cell reference

if i have the name of a macro in cell A1, how can i run
it by referencing the cell address? supposing the value
of A1 will change.
like if i clicked a CommandButton and cell A1
said "PrintSheetOne" it would run the macro
PrintSheetOne. and likewise for two and three etc. i
have :
Private Sub CommandButton4_Click()
Run "(Sheets(Report).Range(A1))"

End Sub
where have i gone wrong?

TIA
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default run a macro from a cell reference

Spence,

Try something like

Application.Run Worksheets("Sheet1").Range("A1").Text



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"spence" wrote in message
...
if i have the name of a macro in cell A1, how can i run
it by referencing the cell address? supposing the value
of A1 will change.
like if i clicked a CommandButton and cell A1
said "PrintSheetOne" it would run the macro
PrintSheetOne. and likewise for two and three etc. i
have :
Private Sub CommandButton4_Click()
Run "(Sheets(Report).Range(A1))"

End Sub
where have i gone wrong?

TIA



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default run a macro from a cell reference

hello, try to rephrase like this
Sub CallHello(
Dim MacroToRun As Varian

MacroToRun = ThisWorkbook.Sheets("Sheet1").Range("A1"
Run MacroToRu

End Su

Sub Hello(
MsgBox "Hello
End Su

regard
Martin
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
Macro using a cell reference Jason Falzon[_2_] Excel Discussion (Misc queries) 3 March 24th 10 04:16 PM
Cell Reference Macro Scott Excel Discussion (Misc queries) 3 June 16th 09 04:13 PM
cell reference in macro AJB Excel Discussion (Misc queries) 2 August 7th 07 04:22 PM
variable cell reference in a macro [email protected] Excel Discussion (Misc queries) 6 January 25th 07 12:34 AM
Chnaging Cell reference through macro ashish128 Excel Discussion (Misc queries) 7 April 25th 06 01:14 PM


All times are GMT +1. The time now is 06:55 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"