+ Reply to Thread
Results 1 to 6 of 6

Can a macro be written that when you open a workbook the zoom will be set for each sheet?

  1. #1
    Marc
    Guest

    Can a macro be written that when you open a workbook the zoom will be set for each sheet?

    Marc



  2. #2
    Gary Keramidas
    Guest

    Re: Can a macro be written that when you open a workbook the zoom will be set for each sheet?

    maybe something like this in a code module

    Option Explicit

    Dim sheet As Worksheet
    Sub Auto_Open()
    For Each sheet In ThisWorkbook.Worksheets
    sheet.Activate
    ActiveWindow.Zoom = 200
    Next
    End Sub

    --


    Gary


    "Marc" <mcnr(N_O-S_P_A_M)@mindspring.com> wrote in message
    news:[email protected]...
    > Marc
    >
    >




  3. #3
    Forum Contributor
    Join Date
    06-13-2004
    Posts
    120
    Yes.

    In Microsoft Visual Basic Editor, under Objects>ThisWorkbook, input the following code:

    Private Sub Workbook_Open()
    For Each ws In Worksheets
    ws.select
    ActiveWindow.Zoom = 100
    Next
    End Sub

    Change the zoom to whatever zoom you want it to be. do not include the % symbol

  4. #4
    Marc
    Guest

    Re: Can a macro be written that when you open a workbook the zoom will be set for each sheet?

    Thanks I get tired of have to do each sheet manually.

    Marc

    "Marc" <mcnr(N_O-S_P_A_M)@mindspring.com> wrote in message
    news:[email protected]...
    > Marc
    >
    >




  5. #5
    Marc
    Guest

    Re: Can a macro be written that when you open a workbook the zoom will be set for each sheet?

    Spoke to soon. I copied it and change the 100 to 75 and tried to run it and
    I get a run time error '1004' "Select method of Worksheet class failed".

    Marc

    "dok112" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Yes.
    >
    > In Microsoft Visual Basic Editor, under Objects>ThisWorkbook, input the
    > following code:
    >
    > Private Sub Workbook_Open()
    > For Each ws In Worksheets
    > ws.select
    > ActiveWindow.Zoom = 100
    > Next
    > End Sub
    >
    > Change the zoom to whatever zoom you want it to be. do not include the
    > % symbol
    >
    >
    > --
    > dok112
    > ------------------------------------------------------------------------
    > dok112's Profile:

    http://www.excelforum.com/member.php...o&userid=10581
    > View this thread: http://www.excelforum.com/showthread...hreadid=530168
    >




  6. #6
    Forum Contributor
    Join Date
    06-13-2004
    Posts
    120
    You will get that error if you have put the code in the wrong spot, or if you are attempting to make the zoom too large. You can go from 10 to 400 percent. If you put that code in a regular module, you will get that error. It has to go into the ThisWorkbook object so it knows to do it when it opens.

    Quote Originally Posted by Marc
    Spoke to soon. I copied it and change the 100 to 75 and tried to run it and
    I get a run time error '1004' "Select method of Worksheet class failed".

    Marc

    "dok112" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Yes.
    >
    > In Microsoft Visual Basic Editor, under Objects>ThisWorkbook, input the
    > following code:
    >
    > Private Sub Workbook_Open()
    > For Each ws In Worksheets
    > ws.select
    > ActiveWindow.Zoom = 100
    > Next
    > End Sub
    >
    > Change the zoom to whatever zoom you want it to be. do not include the
    > % symbol
    >
    >
    > --
    > dok112
    > ------------------------------------------------------------------------
    > dok112's Profile:

    http://www.excelforum.com/member.php...o&userid=10581
    > View this thread: http://www.excelforum.com/showthread...hreadid=530168
    >

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1