Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Recording macro to activate other macros

Hi all,

I was trying to record a macro that uses other macros that i've already
created. Basically what i wanted to do is to go thru each tab in my
workbook, and run a macro on every sheet. But after recording it, the
macro just go thru the sheet w/o running the macro.

Any help would be great!!
Thanks!!


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Recording macro to activate other macros

Sub RunOnAllWorksheets()
for each sh in Activeworkbook.Worksheets
sh.Activate
mymacro
Next
End sub

Sub MyMacro()
Range("A1").Select
Selection.Value = "Processed"
End Sub

this runs the macro MyMacro on every sheet in the active workbook.

Make sure your recorded macro doesn't contain code like
worksheets("Sheet1").Activate
If it contains such code it will aways execute the instructions after that
on Sheet1. Comment out statements like that.

--
Regards,
Tom Ogilvy


"yippy " wrote in message
...
Hi all,

I was trying to record a macro that uses other macros that i've already
created. Basically what i wanted to do is to go thru each tab in my
workbook, and run a macro on every sheet. But after recording it, the
macro just go thru the sheet w/o running the macro.

Any help would be great!!
Thanks!!


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Recording macro to activate other macros

hi tom,

i should've be more specific, sorry. i do have different macro to ru
on diff sheet. for example, i might be running "AR_10" on the shee
call "AR10". do you have the code for me to specify the sheet name an
macro name?

thanks

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Recording macro to activate other macros

Try this


Dim sh As Worksheet

Sub test()
For Each sh In ThisWorkbook.Worksheets
mymacro
Next sh
End Sub

Sub mymacro()
sh.Range("a1").Value = 33
End Sub




--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"yippy " wrote in message ...
Hi all,

I was trying to record a macro that uses other macros that i've already
created. Basically what i wanted to do is to go thru each tab in my
workbook, and run a macro on every sheet. But after recording it, the
macro just go thru the sheet w/o running the macro.

Any help would be great!!
Thanks!!


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Recording macro to activate other macros

Sub RunOnAllWorksheets()
for each sh in Activeworkbook.Worksheets
sh.Activate
Application.Run left(sh.name,2) & "_" & Mid(sh.name,3)
Next
End sub

will run a macro that takes the sheet name and put an underscore in as a new
character

for AR1 it will run AR_1
for AR10 it will run AR_10
for AR100 it will run AR_100

--

Regards,
Tom Ogilvy


"yippy " wrote in message
...
hi tom,

i should've be more specific, sorry. i do have different macro to run
on diff sheet. for example, i might be running "AR_10" on the sheet
call "AR10". do you have the code for me to specify the sheet name and
macro name?

thanks.


---
Message posted from http://www.ExcelForum.com/



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
Recording Macros Joe[_6_] New Users to Excel 3 January 12th 08 05:49 PM
Recording macros Dricon1 Excel Discussion (Misc queries) 1 February 14th 07 03:42 PM
Training: More on how to use macros in Excel: Recording Macros ToriT Excel Worksheet Functions 2 February 10th 06 07:05 PM
How do I make the Stop Recording bar pop up when recording macros J Excel Worksheet Functions 1 January 10th 06 08:46 PM
Macros not recording tCannon Excel Discussion (Misc queries) 3 May 16th 05 08:51 PM


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