ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to iterate through sheets and set ActiveWindow (https://www.excelbanter.com/excel-programming/354356-how-iterate-through-sheets-set-activewindow.html)

[email protected]

How to iterate through sheets and set ActiveWindow
 
Hi,

How do you iterate through the sheets in a weekbook and set each sheet
to the ActiveWindow?

(I need to assign the scrollrow for each sheet.)

Thanks.


Trevor Shuttleworth

How to iterate through sheets and set ActiveWindow
 
For Each Sheet In Sheets
MsgBox Sheet.Name
' your code here
Next 'Sheet

Regards

Trevor


wrote in message
oups.com...
Hi,

How do you iterate through the sheets in a weekbook and set each sheet
to the ActiveWindow?

(I need to assign the scrollrow for each sheet.)

Thanks.




Rick Hansen

How to iterate through sheets and set ActiveWindow
 
Hello There, Try this code in the Workbook_Open event, Should fix you
right up...

enjoy, Rick


Private Sub Workbook_Open()
Dim wsk As Worksheet

Application.ScreenUpdating = False

For Each wsk In Worksheets
If wsk.Name < "Test " Then
wsk.Select
wsk.ScrollArea = "a1:n31" '' << Change Range here
With ActiveWindow
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
End With
End If
Next wsk


End Sub






wrote in message
oups.com...
Hi,

How do you iterate through the sheets in a weekbook and set each sheet
to the ActiveWindow?

(I need to assign the scrollrow for each sheet.)

Thanks.





All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com