Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Recording Macros | New Users to Excel | |||
Recording macros | Excel Discussion (Misc queries) | |||
Training: More on how to use macros in Excel: Recording Macros | Excel Worksheet Functions | |||
How do I make the Stop Recording bar pop up when recording macros | Excel Worksheet Functions | |||
Macros not recording | Excel Discussion (Misc queries) |