View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Code Works for Some Worksheets, But Not Others

the code worked fine for me.

have you tried manually changing that setting on the recalcitrant sheets?

--
Regards,
Tom Ogilvy


"DevDaniel" wrote:

I have a macro which moves to each worksheet and changes the page setup
properties. The code changes the properties on some worksheets, but not
others.

Have anyone had a similar problem? Is the file corrupt? I have tried
- selecting all worksheets and changing the properties
- looping through each worksheet and changing the properties
Neither worked.

Code snippet:

Dim ws As Worksheet

For Each ws In Worksheets

If ws.Name = "Main" Then

With ws.PageSetup
.PrintQuality = 600
.FitToPagesWide = 1
.FitToPagesTall = False
End With

Else

With ws.PageSetup
.PrintQuality = 600
End With

End If

Next ws