Setting the Vertical Page Break in an Excel Macro
Posted on 2003-03-13
Right now I have a workbook with several sheets in it. I run a macro that imports all data into the sheets and then highlights rows based on criteria, then it autoformats all the rows length. When this happens the Vertical Page Break gets set. I would like a way to either get rid of all the Vertical Page breaks on a sheet or how to set them all to the far right column.
Excel gave me this code when I recorded a Macro but it doesn't work in my macro, it gives me Run-time Error 1004:
ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1