ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using text from a cell in header (https://www.excelbanter.com/excel-programming/293057-using-text-cell-header.html)

Emiel

using text from a cell in header
 
Does anybody have a clue if and how I can use the text from a cell in the first line of each page in the header

For example
Page 1: A
Page 2: A5
Page 3: A10
etc

Thanks in adance

Emiel (Holland)

Tom Ogilvy

using text from a cell in header
 
Look at the rows to repeat at the top setting in the the 3rd tab of the page
setup dialog.

If you want to use a different cell at the top of each page in a worksheets,
then you will have to print each page separately and either put the value on
the page or change the value in the rows to repeat location.

--
Regards,
Tom Ogilvy

"Emiel" wrote in message
...
Does anybody have a clue if and how I can use the text from a cell in the

first line of each page in the header?

For example:
Page 1: A1
Page 2: A50
Page 3: A100
etc.

Thanks in adance.

Emiel (Holland)




JE McGimpsey

using text from a cell in header
 
One way:

Put this in theThisWorkbook code module.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim vHeaderCells As Variant
Dim wsSheet As Worksheet
Dim i As Long
Application.EnableEvents = False
Cancel = True
For Each wsSheet In ActiveWindow.SelectedSheets
With wsSheet
If .Name = "Sheet1" Then
vHeaderCells = Array("A1", "A50", "A100")
For i = 1 To UBound(vHeaderCells) + 1
.PageSetup.LeftHeader = _
.Range(vHeaderCells(i - 1)).Value
.PrintOut from:=i, To:=i, preview:=True
Next i
Else
.PrintOut preview:=True
End If
End With
Next wsSheet
Application.EnableEvents = True
End Sub

Change "Sheet1" to suit.

In article ,
"Emiel" wrote:

Does anybody have a clue if and how I can use the text from a cell in the
first line of each page in the header?

For example:
Page 1: A1
Page 2: A50
Page 3: A100
etc.

Thanks in adance.

Emiel (Holland)


0.


All times are GMT +1. The time now is 08:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com