Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default Add/not replace footer

Is it possible to use VBA code to scroll through the sheets in a workbook and
if there's a center footer, add a CRLF and then some text. If there is not
footer, just add the text. I use code to set footers but when I do something
like this:

Dim Sh As Worksheet
For Each Sh In Worksheets
With Sh.PageSetup
.CenterFooter = "Some text" & Chr(10) & "Some more text"
...

I get the footers replaced. I want it added to what's already there. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 427
Default Add/not replace footer

If I read your post correctly, this code should do it. If a footer
exists already, then this code adds to it. Note this Usenet interface
word wraps, so you may need to revise the line breaks.

Sub Append_Footer()
Dim Sh As Worksheet

For Each Sh In Sheets
With Sh.PageSetup
If .CenterFooter < "" Then .CenterFooter = .CenterFooter & " " &
Chr(10) & "Some more text"
End With
Next Sh

End Sub

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
IF formula in Excel / Replace numbers with 'words' Emsmaps Excel Discussion (Misc queries) 1 April 7th 06 11:01 PM
Excel: Add replace within selection functionality Marcel XL Excel Discussion (Misc queries) 1 March 3rd 06 01:51 PM
Custom Footer for each page NAVEEN Excel Worksheet Functions 0 February 21st 06 11:04 AM
Search and replace Subu Excel Worksheet Functions 4 June 9th 05 07:01 PM
replace absolute references bj Excel Worksheet Functions 0 May 20th 05 07:18 PM


All times are GMT +1. The time now is 11:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"