Home > Software engineering >  Vba in the loop
Vba in the loop

Time:10-12

 Sub test () 
A=Sheets. Count
For I=1 To a
Sheets (I). Select
Range (" a1 "). Select
ActiveWindow. Zoom=80
Next
End Sub


Want to put all excel sheet cell into a page set up activities A1, scaling is 80%, but the second sheet page into a A1 is an error, this is how to return a responsibility, or any other methods to achieve this function

CodePudding user response:

Please refer to:
 Sub test () 
Dim Sht As Worksheet
For Each Sht In ThisWorkbook. Sheets
With Sht
. Activate
Range (" a1 "). The Activate
End With
ActiveWindow. Zoom=90
Next
End Sub


CodePudding user response:

reference 1st floor Topc008 response:
please refer to:
 Sub test () 
Dim Sht As Worksheet
For Each Sht In ThisWorkbook. Sheets
With Sht
. Activate
Range (" a1 "). The Activate
End With
ActiveWindow. Zoom=90
Next
End Sub


CodePudding user response:

1/f, code positive solutions

CodePudding user response:

Select and Activate is not the same thing,
  •  Tags:  
  • VBA
  • Related