Header/Footer

  • Thread starter Thread starter LB79
  • Start date Start date
L

LB79

Does anyone know of a way to put a cell value in headers and footers?
need for the User name to show when they print - i can get the name i
the sheet but would prefer it in the header.
Thank
 
Put this code in the Thisworkbook code module

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
ActiveSheet.PageSetup.LeftFooter = Range("A1")
End If
End Sub
 
LB

Should be able to get UserName directly into header/footer.

Sub PathInFooter()
'adjust to suit
ActiveSheet.PageSetup.RightFooter = ActiveWorkbook.FullName & " " & _
ActiveSheet.Name & " " & Application.UserName & " " & Date
End Sub

OR if username is in a cell.........

Sub CellInFooter()
With ActiveSheet
.PageSetup.CenterFooter = .Range("A1").text
End With
End Sub

Gord Dibben Excel MVP
 

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

Back
Top