I'm using Excel 2007 and it's a large file with 15 worksheets. Data goes in one worksheet and a report is produced from a later worksheet. I use the system for many iterations. Works fine (if tediously slowly) but this macro is stalling.
I wanted a macro to add the name of the individual, and the name of the area in the 'header', plus some text, naming the report. I'm not new to programming but am new to VBA, so with help from web gurus put together this code. It worked initially as a
macro - which should update with any information on worksheet 'Instructions' cells A4 and A6 before printing:
Private Sub Workbook_BeforePrint(Cancel As Boolean) Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets ws.PageSetup.RightHeader = "&I" & "&08" & Format(Worksheets("Instructions").Range("a4").Value & vbCr & Worksheets("Instructions").Range("a6").Value & vbCr & "Report 2012 ") Next ws End Sub
The problem is that although the macro runs, it doesn't update with the font information, which I copied and pasted then altered, to the font I wanted; and it doesn't update the values in cells A4 and A6 with new information when I 'save as' the file for
the next iteration.
How do I fix this, please so that the macro runs correctly with the new font info and new saved info in those cells.
Many thanks.