A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
So two ways one you want the page setup to be done beforehand
Select Menu insert/Module In the new window, copy this :
Option explicit ' to avoid wrong variable names, this forces you to DECLARE all the variables.comments, behind coded line have to be precedeed with a simple quote like ' ' the name of the sub need to be given in own word
Sub addMyHeaders
Dim wk As Worksheet
For Each wk In ThisWorkbook.Worksheets
wk.PageSetup.CenterHeader = "Division of " & wk.Range("B2").Value
Next wk
End sub
END OF DATA TO BE COPIED
before executing a macro, thing that ther is no undo in XL macro
Press the F5 function key to run this or press F8 to execute line by line. two Before each print, the page set needt to be corrected
Press ALT F11 double click the " thisworkbook" object in the project explorer add this
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wk As Worksheet
For Each wk In ThisWorkbook.Worksheets
wk.PageSetup.CenterHeader = "Division of " & wk.Range("B2").Value
Next wk
End Sub
You can also read the question Import csv data into Excel 2007 template where my last post give some more info
Regards JY