Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I want to print a multi-page worksheet omitting the header on the first page.
However, I also want to create a macro to do this without embedding the header info in the code. I do not know VBA programming, but I have been reading some web sites and playing around with it. Here's a solution that I thought would work (maybe it just needs some tweaking): Sub NoFirstPageHeader_AllSheets() Dim wsSheet As Worksheet Dim sHeader As String For Each wsSheet In Worksheets With wsSheet sHeader = .PageSetup.LeftHeader .PageSetup.LeftHeader = "" sHeader = .PageSetup.CenterHeader .PageSetup.CenterHeader = "" sHeader = .PageSetup.RightHeader .PageSetup.RightHeader = "" .PrintOut From:=1, To:=1 sHeader = .PageSetup.LeftHeader sHeader = .CenterHeader sHeader = .RightHeader .PrintOut From:=2 End With Next wsSheet End Sub The problem is that this code deletes my header entirely instead of what I intended it to do (omit the header on the first page). I tried to replace "PageSetup" with "Print" but that, of course, did not work. I am surprised that doing a simple thing like omitting the header on the first page is such a big deal. I have come up with a few workarounds, but if anyone knows of a macro that can do what I described, please let me know. Again, the sticky part is that I want this to work in any workbook with different page headers. Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Does anyone know the code to put a number in the right header... | Excel Discussion (Misc queries) | |||
Does anyone know the code to put a number in the right header and. | Excel Discussion (Misc queries) | |||
Does anyone know the code to put a number in the right header... | Excel Discussion (Misc queries) | |||
VBA Code to Add the same header from my first sheet into 20 sheets | Excel Worksheet Functions | |||
Excel-Header-My Company Name won't work in Header (AT&T) & Time | Excel Discussion (Misc queries) |