I programmed a little tool in VBA which generates a sheet with some statistics on it. I want to automatically have a printable worksheet, so I set the VPageBreak like this:
ActiveWindow.View = xlPageBreakPreview ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1 ActiveWindow.View = xlNormalView
At first this worked just fine. But the content of this generated worksheet is based on data in another worksheet and when this data changed, the DragOff-Command threw an error. The error occured because the VPageBreak is now automatically set at a place, where the Dragoff is not possible.
I need reliable code, not depending on the origin-data... Is there a way to say "I want this VPageBreak after column E"?
Thanks in advance