Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
Run macro on all sheets trey1982 Excel Worksheet Functions 3 April 7th 09 03:07 AM
macro for same value in 2 different sheets sharmashanu Excel Discussion (Misc queries) 1 March 15th 07 03:26 AM
"With Sheets" Issue - macro on one sheet to affect hidden rows on other sheets Punsterr Excel Programming 3 February 21st 06 04:01 AM
Macro for filter on protected workbook that works for all sheets, no matter what sheets are named? StargateFanFromWork[_3_] Excel Programming 6 January 26th 06 06:31 PM
macro for new sheets Raza Excel Worksheet Functions 2 November 8th 05 06:10 PM


All times are GMT +1. The time now is 06:37 AM.

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"