Setting all Excel sheets at a defined zoom level Setting all Excel sheets at a defined zoom level vba vba

Setting all Excel sheets at a defined zoom level


Sub SetZoom()    Dim ws As Worksheet    For Each ws In Worksheets        ws.Select        ActiveWindow.Zoom = 85 ' change as per your requirements    Next wsEnd Sub

BTW, if you simply select all worksheets in your workbook using the tabs you can then set the zoom to 85% and it will apply to all worksheets


Sub SetZoom()Dim ws As WorksheetApplication.ScreenUpdating = False    'OptionalFor Each ws In ActiveWorkbook.Worksheets    ws.Activate    ActiveWindow.Zoom = 85NextApplication.ScreenUpdating = TrueEnd Sub

This code is similar from the above, but it is not necessary to select all worksheets in your workbook before running the macro. Instead of using ws.Select and Next ws that not work correctly unless you select the worksheets, change to ws.Activate and Next to set the zoom for all the sheets. As optional, the ScreenUpdating can be disabled for a workbook with a lot of sheets.


Option ExplicitSub FixSheets()    Dim ws As Worksheet    For Each ws In Worksheets        ws.Activate        ws.UsedRange.Select        ActiveWindow.Zoom = True 'Zoom sur la sélection        ActiveCell.Select    Next wsEnd Sub