VBA syntax for one-line of code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using XL 2003 & 97

Attempting to get the following code loop to work.

The code fails where the ???????.?????? is.

Sub Test()
Dim EachSheet As Worksheet
For Each EachSheet In ActiveWorkbook.Worksheets
With EachSheet.?????????.??????????
ActiveWindow.Zoom = 75
ActiveWindow.View = xlPageBreakPreview
End With
Next EachSheet
End Su

Any thoughts?

TIA Dennis
 
Hi
do you want:
Sub Test()
Dim EachSheet As Worksheet
For Each EachSheet In ActiveWorkbook.Worksheets
EachSheet.activate
ActiveWindow.Zoom = 75
ActiveWindow.View = xlPageBreakPreview
Next EachSheet
End Su
 
Thanks Frank,

The code flows ok now. That said, it does not seem to be setting the .zoom
to 75

Is the code line ActiveWindow.Zoom = 75 correct.

What I want is all worksheets to be set for zoom = 75 and the view be set for
PageBreakPreview.

TIA Dennis
 
What does the zoom get set to.

(Frank's code changed it to 75% for me--but if the worksheet were empty, the
zoom was changed to 60%.)

But when I reversed the two lines that did the work, all was ok:

Option Explicit
Sub Test2()
Dim EachSheet As Worksheet
For Each EachSheet In ActiveWorkbook.Worksheets
EachSheet.Activate
ActiveWindow.View = xlPageBreakPreview
ActiveWindow.Zoom = 75
Next EachSheet
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top