#1   Report Post  
Posted to microsoft.public.excel.misc
MrMountain
 
Posts: n/a
Default Change Header data


How can I change the header data on all worksheets at once?
Specifically, I want to change 2004 to 2005 in the header contribution
reports.


--
MrMountain
------------------------------------------------------------------------
MrMountain's Profile: http://www.excelforum.com/member.php...o&userid=30705
View this thread: http://www.excelforum.com/showthread...hreadid=503680

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Change Header data

Are all the page setups exactly the same?

If yes, you could group the sheets that should get changed (click on the first
worksheet tab and ctrl-click on subsequent).

Then file|page setup.

If the page setups are different, you could use a macro.

Option Explicit
Sub testme()

Dim wks As Worksheet
Dim OldYear As String
Dim NewYear As String

OldYear = "2004"
NewYear = "2005"

For Each wks In ActiveWindow.SelectedSheets
With wks.PageSetup
.RightHeader _
= Application.Substitute(.CenterHeader, OldYear, NewYear)
.CenterHeader _
= Application.Substitute(.CenterHeader, OldYear, NewYear)
.LeftHeader _
= Application.Substitute(.CenterHeader, OldYear, NewYear)
End With
Next wks
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Group the worksheets you want fixed, run the macro and ungroup those
worksheets. Remember that almost anything you do to a worksheet that's grouped
with others, you do to all the group.

And if you decide to use this same routine to change other text, you'll have to
be careful. Application.Substitute (and Replace in xl2k+) is case sensitive.



MrMountain wrote:

How can I change the header data on all worksheets at once?
Specifically, I want to change 2004 to 2005 in the header contribution
reports.

--
MrMountain
------------------------------------------------------------------------
MrMountain's Profile: http://www.excelforum.com/member.php...o&userid=30705
View this thread: http://www.excelforum.com/showthread...hreadid=503680


--

Dave Peterson
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
Excel Data into PAge Header retseort Excel Discussion (Misc queries) 7 October 31st 05 03:51 PM
How do I change lowercase data to capped data? Monique Excel Discussion (Misc queries) 2 October 21st 05 12:29 AM
change data source for many queries at once? Sam Raymond Excel Worksheet Functions 0 July 11th 05 04:59 PM
Change Data In Pivot Table John Calder New Users to Excel 1 July 7th 05 10:41 PM
change directory for refresh data TxRaistlin Excel Discussion (Misc queries) 0 February 7th 05 09:09 PM


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

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"