View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
zackb zackb is offline
external usenet poster
 
Posts: 18
Default Macro to set header

Also note that this usually takes a while to loop through and change the
pagesetup of Excel worksheets. (Drives me crazy) So 50 sheets may take you
a while. If you want to know how far along you are, change your code to
something like this ...

sub SetAllHeaders()
dim ws as worksheet, lngWs as long
lngWs = thisworkbook.worksheets.count
for each ws in thisworkbook.worksheets '*
application.statusbar = "Working on " & ws.index & " of " & _
lngWs & " : " & format(ws.index / lngWs, "Percent")
ws.pagesetup.centerheader = ws.name
ws.printout '**
next ws
application.statusbar = false
end sub

You must remember to set the statusbar to False when done.
** Added; forgot in last post. Sorry. :(

--
Regards,
Zack Barresse, aka firefytr


"FGOMEZ" wrote in message
...
I have a file with about 50 different sheets (Names),
I want to print them all, and need to have a header for every sheet, which
is the same name of the TAB, could somebody help me to get a macro to set
the header automatically on every sheet.

Thanks in advance for your help