Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Updating Headers/Footers in VB


Morning

I am updating a whole workbook of Headers and Footers using the
following:

Public Sub UPDATE_HEADER_FOOTER()
Dim mysheet As Worksheet
For Each mysheet In ActiveWorkbook.Sheets
With mysheet.PageSetup
.RightFooter = "Issued by Central Personnel - July 28th 2006"
.RightHeader = "&""Arial,Bold""&11Reporting Period 4" & vbCr & _
"4 Weeks to 16 July 2006"

End With
Next
End Sub


However when the Macro hits a Sheet containing a Chart (Fill page) it
stops and doesn't continue with the rest of the book. (i do want the
charts to have a H and F as well).

ERROR TYPE MISMATCH (ERROR 13)

Please could anyone drop me a hint.?

thanks for your help.


--
Andrew P
------------------------------------------------------------------------
Andrew P's Profile: http://www.excelforum.com/member.php...o&userid=36574
View this thread: http://www.excelforum.com/showthread...hreadid=563206

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Updating Headers/Footers in VB

The problem that you have is that the Chart sheets are members of the Sheets
collection but are not Worksheets. If you declare mysheet as a variant then
it will work

Dim Mysheet

instead of

Dim Mysheet as Worksheet


"Andrew P" wrote:


Morning

I am updating a whole workbook of Headers and Footers using the
following:

Public Sub UPDATE_HEADER_FOOTER()
Dim mysheet As Worksheet
For Each mysheet In ActiveWorkbook.Sheets
With mysheet.PageSetup
.RightFooter = "Issued by Central Personnel - July 28th 2006"
.RightHeader = "&""Arial,Bold""&11Reporting Period 4" & vbCr & _
"4 Weeks to 16 July 2006"

End With
Next
End Sub


However when the Macro hits a Sheet containing a Chart (Fill page) it
stops and doesn't continue with the rest of the book. (i do want the
charts to have a H and F as well).

ERROR TYPE MISMATCH (ERROR 13)

Please could anyone drop me a hint.?

thanks for your help.


--
Andrew P
------------------------------------------------------------------------
Andrew P's Profile: http://www.excelforum.com/member.php...o&userid=36574
View this thread: http://www.excelforum.com/showthread...hreadid=563206


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating data... RK Excel Discussion (Misc queries) 2 May 3rd 06 01:39 PM
updating date! via135 Excel Worksheet Functions 3 February 23rd 06 05:31 PM
Excel 2003 links are not updating between workbooks Tami C Excel Worksheet Functions 3 October 11th 05 02:03 AM
Excel Not Updating Pricklyflower Excel Discussion (Misc queries) 3 October 5th 05 02:20 PM
When updating a worksheet, how do I create a link updating the sa. Phlashh Excel Worksheet Functions 9 January 27th 05 06:05 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"