PC Review


Reply
Thread Tools Rate Thread

Auto footers on multiple pages

 
 
DTTODGG
Guest
Posts: n/a
 
      14th Aug 2009
Hello,

I'm trying to have a macro that will automatically print the file name, tab,
and date at the bottom of each page in each sheet in the workbook.

Thanks in advance for your help!


Dim wksht As Worksheet

For Each wksht In Worksheet

With ActiveSheet.PageSetup
.LeftFooter = "&6&F &A &D"
.FooterMargin = Application.InchesToPoints(0.25)
Next
End Sub
 
Reply With Quote
 
 
 
 
Bob Umlas
Guest
Posts: n/a
 
      14th Aug 2009
Change to:

Dim wksht As Worksheet

For Each wksht In Worksheet

With wksht.PageSetup '<====error was here
.LeftFooter = "&6&F &A &D"
.FooterMargin = Application.InchesToPoints(0.25)
Next
End Sub


"DTTODGG" <(E-Mail Removed)> wrote in message
news:16EBBDB6-6EDC-4A75-880E-(E-Mail Removed)...
> Hello,
>
> I'm trying to have a macro that will automatically print the file name,
> tab,
> and date at the bottom of each page in each sheet in the workbook.
>
> Thanks in advance for your help!
>
>
> Dim wksht As Worksheet
>
> For Each wksht In Worksheet
>
> With ActiveSheet.PageSetup
> .LeftFooter = "&6&F &A &D"
> .FooterMargin = Application.InchesToPoints(0.25)
> Next
> End Sub



 
Reply With Quote
 
DTTODGG
Guest
Posts: n/a
 
      14th Aug 2009
Thanks Bob, that makes sense. I'm really new to this and need every detail
explained.

Does the For/Next require something?
I'm getting an error. I don't know how many sheets there might be.
So, do I need to activate a sheet before the next loop?



"Bob Umlas" wrote:

> Change to:
>
> Dim wksht As Worksheet
>
> For Each wksht In Worksheet
>
> With wksht.PageSetup '<====error was here
> .LeftFooter = "&6&F &A &D"
> .FooterMargin = Application.InchesToPoints(0.25)
> Next
> End Sub
>
>
> "DTTODGG" <(E-Mail Removed)> wrote in message
> news:16EBBDB6-6EDC-4A75-880E-(E-Mail Removed)...
> > Hello,
> >
> > I'm trying to have a macro that will automatically print the file name,
> > tab,
> > and date at the bottom of each page in each sheet in the workbook.
> >
> > Thanks in advance for your help!
> >
> >
> > Dim wksht As Worksheet
> >
> > For Each wksht In Worksheet
> >
> > With ActiveSheet.PageSetup
> > .LeftFooter = "&6&F &A &D"
> > .FooterMargin = Application.InchesToPoints(0.25)
> > Next
> > End Sub

>
>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      14th Aug 2009
You have another typo:

Dim wksht As Worksheet

For Each wksht In Worksheets '<--added S to worksheet
With wksht.PageSetup '<-- same correction as Bob showed.
.LeftFooter = "&6&F &A &D"
.FooterMargin = Application.InchesToPoints(0.25)
Next wksht '<-- wksht not required, but I like it!
End Sub

DTTODGG wrote:
>
> Hello,
>
> I'm trying to have a macro that will automatically print the file name, tab,
> and date at the bottom of each page in each sheet in the workbook.
>
> Thanks in advance for your help!
>
> Dim wksht As Worksheet
>
> For Each wksht In Worksheet
>
> With ActiveSheet.PageSetup
> .LeftFooter = "&6&F &A &D"
> .FooterMargin = Application.InchesToPoints(0.25)
> Next
> End Sub


--

Dave Peterson
 
Reply With Quote
 
DTTODGG
Guest
Posts: n/a
 
      14th Aug 2009
Thank you Bob and Dave.
I can build off of and learn more about excel thru this simple macro.

"Dave Peterson" wrote:

> You have another typo:
>
> Dim wksht As Worksheet
>
> For Each wksht In Worksheets '<--added S to worksheet
> With wksht.PageSetup '<-- same correction as Bob showed.
> .LeftFooter = "&6&F &A &D"
> .FooterMargin = Application.InchesToPoints(0.25)
> Next wksht '<-- wksht not required, but I like it!
> End Sub
>
> DTTODGG wrote:
> >
> > Hello,
> >
> > I'm trying to have a macro that will automatically print the file name, tab,
> > and date at the bottom of each page in each sheet in the workbook.
> >
> > Thanks in advance for your help!
> >
> > Dim wksht As Worksheet
> >
> > For Each wksht In Worksheet
> >
> > With ActiveSheet.PageSetup
> > .LeftFooter = "&6&F &A &D"
> > .FooterMargin = Application.InchesToPoints(0.25)
> > Next
> > End Sub

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      14th Aug 2009
This should work:

Dim wksht As Worksheet
For Each wksht In ThisWorkbook.Worksheets
With wksht.PageSetup
.LeftFooter = "&6&F &A &D"
.FooterMargin = Application.InchesToPoints(0.25)
End With
Next
End Sub



"DTTODGG" <(E-Mail Removed)> wrote in message
news:3C5F7D6B-1E67-491D-9BF3-(E-Mail Removed)...
> Thanks Bob, that makes sense. I'm really new to this and need every detail
> explained.
>
> Does the For/Next require something?
> I'm getting an error. I don't know how many sheets there might be.
> So, do I need to activate a sheet before the next loop?
>
>
>
> "Bob Umlas" wrote:
>
>> Change to:
>>
>> Dim wksht As Worksheet
>>
>> For Each wksht In Worksheet
>>
>> With wksht.PageSetup '<====error was here
>> .LeftFooter = "&6&F &A &D"
>> .FooterMargin = Application.InchesToPoints(0.25)
>> Next
>> End Sub
>>
>>
>> "DTTODGG" <(E-Mail Removed)> wrote in message
>> news:16EBBDB6-6EDC-4A75-880E-(E-Mail Removed)...
>> > Hello,
>> >
>> > I'm trying to have a macro that will automatically print the file name,
>> > tab,
>> > and date at the bottom of each page in each sheet in the workbook.
>> >
>> > Thanks in advance for your help!
>> >
>> >
>> > Dim wksht As Worksheet
>> >
>> > For Each wksht In Worksheet
>> >
>> > With ActiveSheet.PageSetup
>> > .LeftFooter = "&6&F &A &D"
>> > .FooterMargin = Application.InchesToPoints(0.25)
>> > Next
>> > 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
how to use different footers for pages in a worksheet? =?Utf-8?B?bmtqbg==?= Microsoft Frontpage 1 23rd Nov 2005 04:29 PM
Different headers/footers for different pages =?Utf-8?B?UmljaCBGLg==?= Microsoft Word Document Management 4 18th Mar 2004 11:00 PM
Re: different footers on pages Linda Microsoft Excel Worksheet Functions 3 29th Jul 2003 09:51 PM
Re: different footers on pages Ron de Bruin Microsoft Excel Worksheet Functions 0 25th Jul 2003 08:30 PM
Re: different footers on pages Richard O. Neville Microsoft Excel Worksheet Functions 0 25th Jul 2003 07:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:33 PM.