Text from within a sheet into right header

G

Gary''s Student

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightHeader = Cells(10, 3).Value
End Sub

Paste this into ThisWorkbook code, not a standard module
 
J

Jean-Yves

Hi

according Excel VBA help by simply searching Header
RightHeader Property
See Also Applies To Example Specifics
Returns or sets the right part of the header. Read/write String.

Remarks
Special format codes can be used in the header text.

Example
This example prints the filename in the upper-right corner of every page.

Worksheets("Sheet1").PageSetup.RightHeader = "&F"So
Worksheets("Sheet1").PageSetup.RightHeader =
Worksheets("Sheet1").Range("C10")Regards"Darin Kramer"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top