View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman Mike Fogleman is offline
external usenet poster
 
Posts: 1,092
Default Date Inserted in header

You will need to store the date somewhere on the sheet. The code below will
store it in the far right cell of row 1. You will only need to enter it once
for each new sheet.

Sub HeadderFooter()
'
' Macro1 Macro
' Macro recorded 8/17/2005 by cwa9821
'

'
Dim HdrDate As String
If Len(ActiveSheet.PageSetup.CenterHeader) 4 Then
'do nothing
Else
Range("IV1").Value = InputBox("Enter Header Date")
HdrDate = Range("IV1").Value
ActiveSheet.PageSetup.CenterHeader = "&20 " & HdrDate
End If

With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = "AKER****** "
.RightHeader = ""
.LeftFooter = "By: MCone"
.CenterFooter = "&F"
.RightFooter = "Page &P of &N"
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1.83)
.BottomMargin = Application.InchesToPoints(0.8)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.3)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
Selection.Merge Application.Dialogs(xlDialogPageSetup).Show
Range("A1").Select
ActiveCell.FormulaR1C1 = "See Markup of Attached Drawings for Shot
Locations "
Range("A1").Select
Selection.Font.Bold = True
Range("B1").Select
ActiveCell.FormulaR1C1 = "0"
Range("b1:R100").Select
Selection.NumberFormat = "0.000"
Range("A1").Select
End Sub

Mike F