I've created a Macro which runs through an old worksheet, copies most of the data and pastes into a new worksheet where it is then reformatted. The last thing I need to do is set the page breaks so that the worksheet is only one page wide (it can be an indefinite number of pages long). I have used the following code to achieve this:
With ActiveSheet.PageSetup
.AdjustTo = False
.FitToPagesWide = 1
.FitToPagesTall = False
.FitTo = True
End With
This works at setting the Fit To section of the Page set up to 1 by blank but the radio button stays in the Adjust To part. It's not that the worksheet is just too wide for this to work since it is only three columns and when I manually set it to one page by blank it works fine. For some reason it just insists on leaving the page break after the second column. I've even tried the following code which doesn't seem to have any effect at all on the worksheet:
ActiveSheet.VPageBreaks(1)DragOff Direction:=xlToRight, RegionIndex:=1
ActiveSheet.VPageBreaks(1).Location = ActiveSheet.Range("c5")
All of this is simply an attempt to make one page wide which includes only columns A, B, and C.
Any ideas?
With ActiveSheet.PageSetup
.AdjustTo = False
.FitToPagesWide = 1
.FitToPagesTall = False
.FitTo = True
End With
This works at setting the Fit To section of the Page set up to 1 by blank but the radio button stays in the Adjust To part. It's not that the worksheet is just too wide for this to work since it is only three columns and when I manually set it to one page by blank it works fine. For some reason it just insists on leaving the page break after the second column. I've even tried the following code which doesn't seem to have any effect at all on the worksheet:
ActiveSheet.VPageBreaks(1)DragOff Direction:=xlToRight, RegionIndex:=1
ActiveSheet.VPageBreaks(1).Location = ActiveSheet.Range("c5")
All of this is simply an attempt to make one page wide which includes only columns A, B, and C.
Any ideas?