Left Header in 2007

E

E

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top