PC Review


Reply
Thread Tools Rate Thread

Add Footer to All Sheets

 
 
Mike H.
Guest
Posts: n/a
 
      12th Jan 2008
How do I add a footer to all sheets. This doesn't work because the
activesheet is not selected, I dont' think.

Sub AddFooters()
Dim WSheet As Worksheet
For Each WSheet In Worksheet
With ActiveSheet.PageSetup
.LeftFooter = "&Z&F"
.RightFooter = "&A"
.Zoom = False
End With
Next WSheet

End Sub
 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      12th Jan 2008
One way:

Change

With ActiveSheet.PageSetup

to

With WSheet.PageSetup


In article <CFB5BB44-FE27-4375-B656-(E-Mail Removed)>,
Mike H. <(E-Mail Removed)> wrote:

> How do I add a footer to all sheets. This doesn't work because the
> activesheet is not selected, I dont' think.
>
> Sub AddFooters()
> Dim WSheet As Worksheet
> For Each WSheet In Worksheet
> With ActiveSheet.PageSetup
> .LeftFooter = "&Z&F"
> .RightFooter = "&A"
> .Zoom = False
> End With
> Next WSheet
>
> End Sub

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      12th Jan 2008
untried but should work.

Sub AddFooters()
Dim i As Long
For i = 1 To ActiveWorkbook.sheets.Count
With Sheets(i).PageSetup
.LeftFooter = "&Z&F"
.RightFooter = "&A"
.Zoom = False
End With
Next
End Sub

"Mike H." wrote:

> How do I add a footer to all sheets. This doesn't work because the
> activesheet is not selected, I dont' think.
>
> Sub AddFooters()
> Dim WSheet As Worksheet
> For Each WSheet In Worksheet
> With ActiveSheet.PageSetup
> .LeftFooter = "&Z&F"
> .RightFooter = "&A"
> .Zoom = False
> End With
> Next WSheet
>
> End Sub

 
Reply With Quote
 
Mike H.
Guest
Posts: n/a
 
      12th Jan 2008
That modification doesn't compile for me. I get a Variable not defined error
on the For statement?????

"JE McGimpsey" wrote:

> One way:
>
> Change
>
> With ActiveSheet.PageSetup
>
> to
>
> With WSheet.PageSetup
>
>
> In article <CFB5BB44-FE27-4375-B656-(E-Mail Removed)>,
> Mike H. <(E-Mail Removed)> wrote:
>
> > How do I add a footer to all sheets. This doesn't work because the
> > activesheet is not selected, I dont' think.
> >
> > Sub AddFooters()
> > Dim WSheet As Worksheet
> > For Each WSheet In Worksheet
> > With ActiveSheet.PageSetup
> > .LeftFooter = "&Z&F"
> > .RightFooter = "&A"
> > .Zoom = False
> > End With
> > Next WSheet
> >
> > End Sub

>

 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      13th Jan 2008
Yeah - didn't look closely at that line - should be

For Each WSheet in Worksheets

or, more qualified:

For Each WSheet In ActiveWorkbook.Worksheets

In article <9A31D88E-5728-4023-BD2B-(E-Mail Removed)>,
Mike H. <(E-Mail Removed)> wrote:

> That modification doesn't compile for me. I get a Variable not defined error
> on the For statement?????
>
> "JE McGimpsey" wrote:
>
> > One way:
> >
> > Change
> >
> > With ActiveSheet.PageSetup
> >
> > to
> >
> > With WSheet.PageSetup
> >
> >
> > In article <CFB5BB44-FE27-4375-B656-(E-Mail Removed)>,
> > Mike H. <(E-Mail Removed)> wrote:
> >
> > > How do I add a footer to all sheets. This doesn't work because the
> > > activesheet is not selected, I dont' think.
> > >
> > > Sub AddFooters()
> > > Dim WSheet As Worksheet
> > > For Each WSheet In Worksheet
> > > With ActiveSheet.PageSetup
> > > .LeftFooter = "&Z&F"
> > > .RightFooter = "&A"
> > > .Zoom = False
> > > End With
> > > Next WSheet
> > >
> > > End Sub

> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Same Header/Footer-Different Sheets =?Utf-8?B?U2t5ZGl2ZXI=?= Microsoft Excel Misc 5 28th Oct 2006 12:31 AM
footer for chart sheets =?Utf-8?B?bWFyeWo=?= Microsoft Excel Misc 4 20th Jun 2005 06:41 PM
Header and Footer on all sheets Bradley C. Hammerstrom Microsoft Excel Misc 1 29th May 2004 12:51 AM
How to set footer and header for all sheets? Kurt Remlin Microsoft Excel Programming 2 1st May 2004 07:10 AM
Macro to set footer in all the sheets Fernando Gomez Microsoft Excel Discussion 2 10th Mar 2004 08:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:45 PM.