LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default How to change the number in a header with each print?

On Aug 15, 1:58 pm, Richard wrote:
This is in the right header only, no cells in the regular worksheet.
I am doing this for a document where each time I print the number in the
right header has to change without anyone seeing it from the regular
worksheet. I would really appreciate the help as I am still learning excel.



You could use a macro to do this. I'd save your number in a specific
cell in a hidden column. In the example below, I'm saving a number in
the cell A1 on Sheet 1 just as an example. The macro adds 1 to the
number and then uses that number to modify what is in the Right Hand
Header.

Sub ModifyHeader()
With ActiveSheet.PageSetup
Sheet1.Cells(1, 1).Value = Sheet1.Cells(1, 1).Value + 1
.RightHeader = Sheet1.Cells(1, 1).Value
End With
End Sub

Then you can use the BeforePrint event to call the macro. This can be
found by going to Tools..Macro..Visual Basic Editor. Use the
ThisWorkbook object.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Call ModifyHeader
End Sub

 
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
How do I get a number to change after each print? Jennifer-Houston, TX Excel Discussion (Misc queries) 7 August 9th 07 08:46 PM
My header and footer show in print preview but don't print. Nancy Excel Discussion (Misc queries) 1 January 25th 07 09:59 PM
use a range for a print header sjl Excel Discussion (Misc queries) 2 April 25th 06 09:35 PM
How print header row at top of each page? Jack Excel Discussion (Misc queries) 4 February 26th 06 01:23 AM
Print header Minerva Excel Worksheet Functions 0 February 21st 06 08:58 AM


All times are GMT +1. The time now is 02:04 AM.

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"