ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Left Header in 2007 (https://www.excelbanter.com/excel-programming/418023-left-header-2007-a.html)

E[_4_]

Left Header in 2007
 
Hi,

I'm having trouble updating the left header. Have read some posts but
haven't found solutions yet. Below is a subroutine that did work in
Excel 2003, but I have had no luck in Excel 2007. The left header
exists in page setup already. The macro is simply to refresh the text.
Perhaps one of the lines of text is too long or something. But when
just viewing the header in page layout view it seems ok.

If anyone can tell me what may be wrong I would be greatly
appreciative.

Thanks in advance.

Eric


Sub refresh_header()
Dim wk As Worksheet
For Each wk In ThisWorkbook.Worksheets
If wk.Visible = xlSheetVisible Then
wk.Calculate
Select Case Left(wk.Name, 2)
Case "h_", "v_"
wk.PageSetup.LeftHeader = "&08" &
wk.Range("anchor").Offset(-7, 0) & vbCr & _
wk.Range("anchor").Offset(-6, 0) & vbCr & _
wk.Range("anchor").Offset(-5, 0) & vbCr & _
wk.Range("anchor").Offset(-4, 0) & vbCr & _
wk.Range("anchor").Offset(-3, 0) & vbCr & _
wk.Range("anchor").Offset(-2, 0)
Case Else
End Select
End If
Next wk
End Sub


All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com