Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Generalize sub to work on all open books and views
How could the sub below be generalized to work on all simultaneously open
books and views (I may have some books open with multiple windows)? The sub currently works only on the activebook/view (where the cursor is). Thanks Sub NoGridLinesZoom75() Dim ws As Worksheet Dim wsht As Worksheet Set wsht = ActiveSheet For Each ws In ActiveWorkbook.Worksheets ws.Activate ActiveWindow.DisplayGridlines = False ActiveWindow.Zoom = 75 Next wsht.Select End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Generalize sub to work on all open books and views
Hi
Try this: Sub NoGridLinesZoom75() Dim wbk As Workbook Dim ws As Worksheet Dim wsht As Worksheet Application.ScreenUpdating = False Set wsht = ActiveWorkbook.ActiveSheet For Each wbk In Application.Workbooks For Each ws In wbk.Worksheets ws.Activate ActiveWindow.DisplayGridlines = False ActiveWindow.Zoom = 75 Next Next wsht.Select Application.ScreenUpdating = True End Sub Regards, Per On 17 Jul., 15:55, Max wrote: How could the sub below be generalized to work on all simultaneously open books and views (I may have some books open with multiple windows)? The sub currently works only on the activebook/view (where the cursor is). Thanks Sub NoGridLinesZoom75() * * Dim ws As Worksheet * * Dim wsht As Worksheet * * Set wsht = ActiveSheet * * For Each ws In ActiveWorkbook.Worksheets * * * * ws.Activate * * * * ActiveWindow.DisplayGridlines = False * * * * ActiveWindow.Zoom = 75 * * Next * *wsht.Select End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Generalize sub to work on all open books and views
Sub NoGridLinesZoom75()
Dim ws As Worksheet Dim wsht As Worksheet dim wb as workbook Set wsht = wb.ActiveSheet for each wb in workbooks wb.activate For Each ws In wb.Worksheets ws.Activate ActiveWindow.DisplayGridlines = False ActiveWindow.Zoom = 75 Next wsht.Select next End Sub "Max" wrote in message ... How could the sub below be generalized to work on all simultaneously open books and views (I may have some books open with multiple windows)? The sub currently works only on the activebook/view (where the cursor is). Thanks Sub NoGridLinesZoom75() Dim ws As Worksheet Dim wsht As Worksheet Set wsht = ActiveSheet For Each ws In ActiveWorkbook.Worksheets ws.Activate ActiveWindow.DisplayGridlines = False ActiveWindow.Zoom = 75 Next wsht.Select End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Generalize sub to work on all open books and views
The sub halted here when I tried it:
Set wsht = wb.ActiveSheet Runtime error 91, object variable or with block variable not set |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Generalize sub to work on all open books and views
Thanks, Per. Tried it out, and it works fine
Max |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
formula to work in a 3-d reference with 2 work books | Excel Worksheet Functions | |||
need a function that will work using multiple work books and sheet | Excel Worksheet Functions | |||
How to generalize sorting range in macro??? | Excel Programming | |||
Counting dates in multiple work sheets and work books | Excel Discussion (Misc queries) | |||
Work books | Excel Worksheet Functions |