Hi
Untested (No printer om my machine on this moment)
Try this example for pages below each other
Let me know if t is working correct
It will print the cell in A and C from the first row in each page in
the header.
Sub Test_For_Each_HPageBreak()
Dim HPB As HPageBreak
Dim RW As Long
Dim PageNum As Long
Dim Asheet As Worksheet
Set Asheet = ActiveSheet
RW = 1
PageNum = 1
If Asheet.HPageBreaks.Count = 0 Then
MsgBox "There are no HPageBreaks"
Exit Sub
End If
For Each HPB In Asheet.HPageBreaks
With Asheet.PageSetup
.RightHeader = Asheet.Cells(RW, "A") & " " & Asheet.Cells(RW, "C")
ActiveSheet.PrintOut From:=PageNum, To:=PageNum
End With
RW = HPB.Location.Row
PageNum = PageNum + 1
Next HPB
Asheet.DisplayPageBreaks = False
End Sub
--
Regards Ron de Bruin
http://www.rondebruin.nl
"Ronbmy" wrote in message
...
I have been given a worksheet to print that will consist of 300 a4
pages.
What I would like to do is take the value of 2 cells from each page and
print them in the header for that page. This will allow a simple
indexing system without having to examine each page.
The pages are identical in layout and the same 2 cells will be used
from each page.
I have tried the standard 'cell in header' but that would print the
same info on every page. Is there a way to do this automatically?
I have never done macros in excel so all help will be appreciated.
Thanks
Ron.
--
Ronbmy
------------------------------------------------------------------------
Ronbmy's Profile: http://www.excelforum.com/member.php...o&userid=24164
View this thread: http://www.excelforum.com/showthread...hreadid=379477