Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default 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.
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
Header Text Stephen Tamchin Excel Discussion (Misc queries) 1 May 20th 10 10:15 PM
Can't view Header Text Prancer3 New Users to Excel 2 January 10th 09 11:17 PM
Header Row Cell Text perplexed Excel Worksheet Functions 4 March 11th 06 08:37 PM
Replace &F in header with text amthyst826 Excel Discussion (Misc queries) 7 October 31st 05 11:12 PM
How to reference a text cell that changes weekly in Header or Foo. duane Excel Discussion (Misc queries) 2 March 20th 05 02:31 PM


All times are GMT +1. The time now is 10:12 PM.

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"