View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Code Works for Some Worksheets, But Not Others


You may have meant to say
If ws.Name < "Main" Then

--
Don Guillett
SalesAid Software

"DevDaniel" wrote in message
...
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