How to change the number in a header with each print?
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. |
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 |
All times are GMT +1. The time now is 03:40 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com