Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default adding footer to all existing sheets in workbook and also to newsheets which is added

Urgnently i need a macro for adding footer to all existing sheets in
workbook and also to new sheets which is added

for example ther are two sheets named Yearly report, monthly report.
When I open this workbook i need to add a footer.also if i add a new
sheet called weekly report, then the footer has to come automatically.
Pls help me frends.Its urgent
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default adding footer to all existing sheets in workbook and also to newsheets which is added

Dinesh,

Try the following:

Step 1, record a macro where you create a footer with all settings you wish the footers to have.

Step 2, open the VBA editor and change the very first line from "Sub Macro1()" to "Sub CreateFooter(wsSheet as Worksheet)".

Step 3, do a Find and Replace to replace all instances of "ActiveSheet" with "wsSheet".

Step 4, go to the "ThisWorkbook" module and paste this code (this will add footer to any new sheet):

Private Sub Workbook_NewSheet(ByVal Sh As Object)
Call CreateFooter(Sh)
End Sub

Step 5 (optional), add this code to your VBA project and run it from an active workbook to apply footer to all sheets:

Sub AddFooter()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Call CreateFooter(ws)
Next
End Sub

Hope this helps,

Ben

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
Adding Headers and Footer to an Entire Workbook?? Spyder Excel Discussion (Misc queries) 5 February 25th 10 03:46 PM
Adding a new worksheet to a workbook at the end of existing workbo CBedford12 Excel Discussion (Misc queries) 2 August 21st 09 03:34 PM
Get data from existing sheets in workbook farid2001 Excel Programming 0 November 12th 08 06:35 AM
ADDING MORE WORKSHEETS TO AN EXISTING WORKBOOK SANDRA@ARTLITE Excel Discussion (Misc queries) 4 February 21st 07 02:16 PM
ADDING MORE WORKSHEETS TO AN EXISTING WORKBOOK Dave F Excel Discussion (Misc queries) 0 February 15th 07 04:23 PM


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