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
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
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" <[email protected]> wrote in message
news:[email protected]...
> 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
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" <[email protected]> wrote in message
news:[email protected]...
>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
http://groups.google.ca/group/micros...8f663cd8d06cff
and
http://groups.google.ca/group/micros...804253b0df176d
These are the answers for you
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" <[email protected]> wrote in message
> news:[email protected]...
> >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
>
>
>
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" <[email protected]> wrote
in message news:[email protected]...
>
> 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
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks