Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron Ron is offline
external usenet poster
 
Posts: 250
Default Generating Footers for Multiple sheets in Workbook

Hi,
I am just beginning to try and learn about VBA. I have a spreadsheet that
has 79 different tabs that I use for a price book. I need to be able to
automatically change the footers with a new effective date on each tab. I
have the following code which works ok, but I have to run it on each tab. Is
there a way to write this that will automatically change all 79 tabs by
running it only once?

ActiveSheet.PageSetup.RightFooter = "&I& Effective:February 20, 2006"

Any help would be greatly appreciated.
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default Generating Footers for Multiple sheets in Workbook

(adjust to your needs).

Customize the Page Sections (Header/Footer)of a worksheet as desired.
Then from this same worksheet - run this macro:

Sub change_all_myPgSettings()
With ActiveSheet
LF = .PageSetup.LeftFooter
CF = .PageSetup.CenterFooter
RF = .PageSetup.RightFooter
LH = .PageSetup.LeftHeader
CH = .PageSetup.CenterHeader
RH = .PageSetup.RightHeader
End With

For Each sht In Sheets
sht.Select
ActiveSheet.PageSetup.LeftFooter = LF
ActiveSheet.PageSetup.CenterFooter = CF
ActiveSheet.PageSetup.RightFooter = RF
ActiveSheet.PageSetup.LeftHeader = LH
ActiveSheet.PageSetup.CenterHeader = CH
ActiveSheet.PageSetup.RightHeader = RH
Next sht
End Sub

Report back, if problems.
Remember to back up you r file before trying ANYTHING NEW!!



"Ron" wrote:

Hi,
I am just beginning to try and learn about VBA. I have a spreadsheet that
has 79 different tabs that I use for a price book. I need to be able to
automatically change the footers with a new effective date on each tab. I
have the following code which works ok, but I have to run it on each tab. Is
there a way to write this that will automatically change all 79 tabs by
running it only once?

ActiveSheet.PageSetup.RightFooter = "&I& Effective:February 20, 2006"

Any help would be greatly appreciated.
Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
Ron Ron is offline
external usenet poster
 
Posts: 250
Default Generating Footers for Multiple sheets in Workbook

Thanks Jim, That works like a charm.

"Jim May" wrote:

(adjust to your needs).

Customize the Page Sections (Header/Footer)of a worksheet as desired.
Then from this same worksheet - run this macro:

Sub change_all_myPgSettings()
With ActiveSheet
LF = .PageSetup.LeftFooter
CF = .PageSetup.CenterFooter
RF = .PageSetup.RightFooter
LH = .PageSetup.LeftHeader
CH = .PageSetup.CenterHeader
RH = .PageSetup.RightHeader
End With

For Each sht In Sheets
sht.Select
ActiveSheet.PageSetup.LeftFooter = LF
ActiveSheet.PageSetup.CenterFooter = CF
ActiveSheet.PageSetup.RightFooter = RF
ActiveSheet.PageSetup.LeftHeader = LH
ActiveSheet.PageSetup.CenterHeader = CH
ActiveSheet.PageSetup.RightHeader = RH
Next sht
End Sub

Report back, if problems.
Remember to back up you r file before trying ANYTHING NEW!!



"Ron" wrote:

Hi,
I am just beginning to try and learn about VBA. I have a spreadsheet that
has 79 different tabs that I use for a price book. I need to be able to
automatically change the footers with a new effective date on each tab. I
have the following code which works ok, but I have to run it on each tab. Is
there a way to write this that will automatically change all 79 tabs by
running it only once?

ActiveSheet.PageSetup.RightFooter = "&I& Effective:February 20, 2006"

Any help would be greatly appreciated.
Thanks

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
Can I duplicate headers and footers on multiple sheets? HeatherDBecerra Excel Worksheet Functions 2 April 13th 07 09:12 PM
Generating parts list from multiple sheets Prescher New Users to Excel 1 April 7th 07 12:14 AM
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA Amaxwell Excel Worksheet Functions 4 August 17th 06 06:23 AM
how to add footers to ALL sheets in a workbook at once? KikiMarie Excel Discussion (Misc queries) 2 October 7th 05 09:53 PM
Generating multiple sheets within a workbook all titled with a ca. Matt Excel Programming 1 February 18th 05 09:55 PM


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