Setting customised zoom level for individual sheets at Workbook Open?

  • Hi!


    I have a quite a few worksheets (let us say Sheet1, Sheet2, Sheet3) in my workbook, each with individual levels of zoom.
    I have the following code that can set zoom levels for individual worksheets each time a worksheet is accessed:


    Code
    Private Sub Worksheet_Activate()
     Windows(1).Zoom = 80
    End Sub


    However, the problem (as with all macros) is that the above code disables the undo function in case I change back and forth from individual sheets, since it is run every time I access a sheet.


    Following macro sets a default zoom level for all worksheets at the time of opening the workbook:

    Code
    For Each ws In Worksheets 
     ActiveWindow.Zoom = 85 
     Next ws 
    End Sub


    But this second code sets a single zoom level for all workbooks.


    I was wondering how to combine these 2 codes to set customised zoom level to each of the worksheets (Sheet1, Sheet2, Sheet3). But I wish to set this ONLY at the time of opening the workbook and not afterwards. In other words, can I point the zoom level for each worksheet at the time of workbook open?


    Regards,


    Naira

  • Re: Setting customised zoom level for individual sheets at Workbook Open?


    You have the loop .... just have to set the zoom per each sheet upon activating it.


  • Re: Setting customised zoom level for individual sheets at Workbook Open?


    Quote from iwrk4dedpr;720710

    You have the loop .... just have to set the zoom per each sheet upon activating it.


    Thanx!!! Works like a charm!


    For those wondering or new to VBA, add the below code above iwk4dedpr's solution and the zoom levels will be set automatically to the desired level at the time of workbook opening:

    Code
    Private Sub Workbook_Open()
        Dim ws As Worksheet

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!