Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi there, Just started to create a set of macro's to generated a report from messy input sheet. This is the first time I work with macro's so still have a lot to learn :) In one macro I want to loop through all (currently 12) available shee to "refresh" the page break settings for those sheets. 1) How can I transfor this into a loop construction? 2) How can I make "ActiveSheet.VPageBreaks(1).DragOf Direction:=xlToRight, RegionIndex:=1" optional?? Because on some sheet I get the following error -Run-time error "9": Subscript out of range- I suspect this is caused by the fact that the data on that particulai sheet can be printed @ 100% on a single page... Code ------------------- Sub RefreshPageBreaks() ' This is, of course, only part of the code I have for the 12 tables... Sheets("PO").Select ActiveWindow.View = xlPageBreakPreview Range("A1").Select ActiveSheet.PageSetup.PrintArea = "" ActiveSheet.ResetAllPageBreaks ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1 ActiveWindow.View = xlNormalView Range("A1").Select Sheets("CC").Select ActiveWindow.View = xlPageBreakPreview Range("A1").Select ActiveSheet.PageSetup.PrintArea = "" ActiveSheet.ResetAllPageBreaks ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1 ActiveWindow.View = xlNormalView Range("A1").Select End Su ------------------- -- s80N ----------------------------------------------------------------------- s80NL's Profile: http://www.excelforum.com/member.php...fo&userid=3637 View this thread: http://www.excelforum.com/showthread.php?threadid=56158 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sheet format questions -- Excel 2007 | New Users to Excel | |||
two questions, Yes/No form control, and how did they create this adjustable area on the sheet... | Excel Discussion (Misc queries) | |||
2 Small VBA Questions; Text To Columns and Naming First Sheet | Excel Discussion (Misc queries) | |||
Questions on copying from one sheet to the other and coping every other cell. | Excel Discussion (Misc queries) | |||
2 questions, copying data from sheet to sheet and assigning macro | Excel Worksheet Functions |