Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jan Jan is offline
external usenet poster
 
Posts: 159
Default Same footer for worksheets (grouped)

I have a workbook with several spreadsheets, which I will be using each month
as a template. I recorded a macro with the hopes of grouping the worksheets
and then selecting the page setup to create the same footer information,
"Date prepared: & Date", on each worksheet. Although the macro groups the
worksheets, it only puts the footer information on the Summary worksheet.
Below is the code. Can anyone help me revise the code to put the footer on
each worksheet.

Sub GroupFooter()
'
' GroupFooter Macro
' Macro recorded 12/21/2006
Sheets(Array("Summary", "IFS Corp", "DASHIELL", "DACON", "MJELECTRIC", "BP",
"IUS", _
"ITS")).Select
Sheets("Summary").Activate 'I think this is part of the problem
With ActiveSheet.PageSetup
..LeftHeader = ""
..CenterHeader = "&G"
..RightHeader = ""
..LeftFooter = ""
..CenterFooter = ""
..RightFooter = "&""Arial,Italic""&8Date prepared: &D"
..LeftMargin = Application.InchesToPoints(0.5)
..RightMargin = Application.InchesToPoints(0.5)
..TopMargin = Application.InchesToPoints(1.1)
..BottomMargin = Application.InchesToPoints(1)
..HeaderMargin = Application.InchesToPoints(0.5)
..FooterMargin = Application.InchesToPoints(0.5)
..PrintHeadings = False
..PrintGridlines = False
..PrintComments = xlPrintNoComments
..PrintQuality = 600
..CenterHorizontally = True
..CenterVertically = False
..Orientation = xlPortrait
..Draft = False
..PaperSize = xlPaperLetter
..FirstPageNumber = xlAutomatic
..Order = xlDownThenOver
..BlackAndWhite = False
..Zoom = False
..FitToPagesWide = 1
..FitToPagesTall = False
..PrintErrors = xlPrintErrorsDisplayed
End With
End Sub

TIA
Jan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Same footer for worksheets (grouped)

Sub GroupFooter()
'
' GroupFooter Macro
' Macro recorded 12/21/2006
Sheets(Array("Summary", "IFS Corp", "DASHIELL", "DACON", "MJELECTRIC", "BP",
"IUS", _
"ITS")).Select
for each sh in ActiveWindow.SelectedSheets
With sh.PageSetup
..LeftHeader = ""
..CenterHeader = "&G"
..RightHeader = ""
..LeftFooter = ""
..CenterFooter = ""
..RightFooter = "&""Arial,Italic""&8Date prepared: &D"
..LeftMargin = Application.InchesToPoints(0.5)
..RightMargin = Application.InchesToPoints(0.5)
..TopMargin = Application.InchesToPoints(1.1)
..BottomMargin = Application.InchesToPoints(1)
..HeaderMargin = Application.InchesToPoints(0.5)
..FooterMargin = Application.InchesToPoints(0.5)
..PrintHeadings = False
..PrintGridlines = False
..PrintComments = xlPrintNoComments
..PrintQuality = 600
..CenterHorizontally = True
..CenterVertically = False
..Orientation = xlPortrait
..Draft = False
..PaperSize = xlPaperLetter
..FirstPageNumber = xlAutomatic
..Order = xlDownThenOver
..BlackAndWhite = False
..Zoom = False
..FitToPagesWide = 1
..FitToPagesTall = False
..PrintErrors = xlPrintErrorsDisplayed
End With
Next
End Sub

You need to minimixe the number of properties you set as each one will take
a measurable amount of time. Most of these are default values, so only
change what you need.
example
..LeftHeader = ""

not needed.

--
Regards,
Tom Ogilvy


"Jan" wrote in message
...
I have a workbook with several spreadsheets, which I will be using each
month
as a template. I recorded a macro with the hopes of grouping the
worksheets
and then selecting the page setup to create the same footer information,
"Date prepared: & Date", on each worksheet. Although the macro groups the
worksheets, it only puts the footer information on the Summary worksheet.
Below is the code. Can anyone help me revise the code to put the footer on
each worksheet.

Sub GroupFooter()
'
' GroupFooter Macro
' Macro recorded 12/21/2006
Sheets(Array("Summary", "IFS Corp", "DASHIELL", "DACON", "MJELECTRIC",
"BP",
"IUS", _
"ITS")).Select
Sheets("Summary").Activate 'I think this is part of the problem
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "&G"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = "&""Arial,Italic""&8Date prepared: &D"
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(1.1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub

TIA
Jan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Same footer for worksheets (grouped)

hi tom:

i noticed your comment at the bottom about some items that are not needed. i got
bit by this.

in one report i set a left header with the date date(). on another report, i
didn't have a left header property. the next day, the report with no left header
printed the left header with the prior's days date, even though i had not set a
left header property.

now, if i set a property somewhere on some report, i always set that property to
"" on every report, even when it's not used.

your comments are welcome.
--


Gary


"Tom Ogilvy" wrote in message
...
Sub GroupFooter()
'
' GroupFooter Macro
' Macro recorded 12/21/2006
Sheets(Array("Summary", "IFS Corp", "DASHIELL", "DACON", "MJELECTRIC", "BP",
"IUS", _
"ITS")).Select
for each sh in ActiveWindow.SelectedSheets
With sh.PageSetup
.LeftHeader = ""
.CenterHeader = "&G"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = "&""Arial,Italic""&8Date prepared: &D"
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(1.1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed
End With
Next
End Sub

You need to minimixe the number of properties you set as each one will take a
measurable amount of time. Most of these are default values, so only change
what you need.
example
.LeftHeader = ""

not needed.

--
Regards,
Tom Ogilvy


"Jan" wrote in message
...
I have a workbook with several spreadsheets, which I will be using each month
as a template. I recorded a macro with the hopes of grouping the worksheets
and then selecting the page setup to create the same footer information,
"Date prepared: & Date", on each worksheet. Although the macro groups the
worksheets, it only puts the footer information on the Summary worksheet.
Below is the code. Can anyone help me revise the code to put the footer on
each worksheet.

Sub GroupFooter()
'
' GroupFooter Macro
' Macro recorded 12/21/2006
Sheets(Array("Summary", "IFS Corp", "DASHIELL", "DACON", "MJELECTRIC", "BP",
"IUS", _
"ITS")).Select
Sheets("Summary").Activate 'I think this is part of the problem
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "&G"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = "&""Arial,Italic""&8Date prepared: &D"
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(1.1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub

TIA
Jan





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
formula problem in grouped worksheets Bo Excel Discussion (Misc queries) 1 August 18th 09 01:15 AM
Filtering grouped worksheets Ian Grega Excel Discussion (Misc queries) 0 August 31st 08 02:33 AM
Page numbering - grouped worksheets Charlotte Howard Excel Discussion (Misc queries) 0 November 5th 07 02:32 PM
Printing Footers on Grouped Worksheets ExcelNovice Excel Discussion (Misc queries) 1 September 27th 07 02:47 PM
Using Smart Tags with Grouped WorkSheets Tim Excel Discussion (Misc queries) 0 December 13th 04 01:47 AM


All times are GMT +1. The time now is 06:51 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"