Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
run a macro for all sheets
I recorded a macro that i use to format a sheet. I would like to use this
same macro on multiple sheets without having to select each one and then running the macro. thanks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
run a macro for all sheets
Bwoods, use something like this,
Sub Test() Dim ws As Worksheet For Each ws In Worksheets With ws 'Change to your code .Range("A1").Interior.ColorIndex = 6 End With Next ws End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Bwoods" wrote in message ... I recorded a macro that i use to format a sheet. I would like to use this same macro on multiple sheets without having to select each one and then running the macro. thanks in advance |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
run a macro for all sheets
Here's a loop I got from Tom O. just yesterday
Sub CodeForEachSheet() Dim WS_Count As Integer Dim I As Integer WS_Count = ActiveWorkbook.Worksheets.Count Application.ScreenUpdating = False For I = 1 To WS_Count Worksheets(I).Activate ' Your code here Next I Worksheets(1).Activate Application.ScreenUpdating = True End Sub HTH Regard, Howard "Bwoods" wrote in message ... I recorded a macro that i use to format a sheet. I would like to use this same macro on multiple sheets without having to select each one and then running the macro. thanks in advance |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
run a macro for all sheets
http://tinyurl.com/r6mfz and http://tinyurl.com/mpq2d These are the answers for yo -- davesexce ----------------------------------------------------------------------- davesexcel's Profile: http://www.excelforum.com/member.php...fo&userid=3170 View this thread: http://www.excelforum.com/showthread.php?threadid=52409 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
run a macro for all sheets
That did the TRICK!!!! This will save me a ton of time!
"L. Howard Kittle" wrote: Here's a loop I got from Tom O. just yesterday Sub CodeForEachSheet() Dim WS_Count As Integer Dim I As Integer WS_Count = ActiveWorkbook.Worksheets.Count Application.ScreenUpdating = False For I = 1 To WS_Count Worksheets(I).Activate ' Your code here Next I Worksheets(1).Activate Application.ScreenUpdating = True End Sub HTH Regard, Howard "Bwoods" wrote in message ... I recorded a macro that i use to format a sheet. I would like to use this same macro on multiple sheets without having to select each one and then running the macro. thanks in advance |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
run a macro for all sheets
Didn't see anything pertinent to the questions asked. Sure you posted this
in the correct thread. Unless you meant run it on each sheet manually which the OP said he/she didn't want to do. -- Regards, Tom Ogilvy "davesexcel" wrote in message ... http://tinyurl.com/r6mfz and http://tinyurl.com/mpq2d These are the answers for you -- davesexcel ------------------------------------------------------------------------ davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708 View this thread: http://www.excelforum.com/showthread...hreadid=524090 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Run macro on all sheets | Excel Worksheet Functions | |||
macro for same value in 2 different sheets | Excel Discussion (Misc queries) | |||
"With Sheets" Issue - macro on one sheet to affect hidden rows on other sheets | Excel Programming | |||
Macro for filter on protected workbook that works for all sheets, no matter what sheets are named? | Excel Programming | |||
macro for new sheets | Excel Worksheet Functions |