View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
E[_4_] E[_4_] is offline
external usenet poster
 
Posts: 1
Default 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