PDA

View Full Version : Solved: PageSetup



jmenche
06-02-2011, 06:56 AM
Howdy,

I am looping through all worksheets in a file and for some reason cannot turn the dotted print area lines off. I recorded a macro and replicated it in my routine and it still doesn't work. Here's what I've got so far:

Dim ws as worksheet

for each ws in activeworkbook.worksheets
ws.activate
'bunch of other stuff
with ws.pagesetup
.printarea = ""
.fittopagestall = 1
.fittopageswide = 1
end with
next

After I run my main macro, I still have to select all of my worksheets and do the pagesetup thingy.

Anyone know what i'm doing wrong?

:beerchug:

Chabu
06-02-2011, 10:03 AM
When I tried it I needed to change it like this
Public Sub pr()
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
ws.Activate
'bunch of other stuff
With ws.PageSetup
.PrintArea = ""
.FitToPagesTall = 1
.FitToPagesWide = 1
.Zoom = False
End With
Next
End Sub

try if that works
Greetings

jmenche
06-02-2011, 10:21 AM
Bootyful! Thanks, Chabu!

It was minor but, as i'm sure with everyone else here, I needed to know!