+ Reply to Thread
Results 1 to 3 of 3

VBA Code to set the zoom automatically to display a certain range of cells

  1. #1
    Registered User
    Join Date
    11-03-2014
    Location
    Southampton
    MS-Off Ver
    2014
    Posts
    7

    VBA Code to set the zoom automatically to display a certain range of cells

    I have a finances spreadsheet that has a scroll lock placed upon it and is formatted to fit perfectly within a 1080p display,

    I have found when using a lower resolution display that the zoom is not correct upon opening so I am trying to find out what VBA code i need to use to have the workbook open to display the scoll lock's range of cells or set the zoom automatically so it fits every screen it opens on.

    Many thanks for your help!

    Will

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,944

    Re: VBA Code to set the zoom automatically to display a certain range of cells

    In the codemodule of the Thisworkbook object, use code like this:

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    06-10-2014
    Posts
    4

    Re: VBA Code to set the zoom automatically to display a certain range of cells

    Hello.
    I use to work with two different monitors (a laptop and an external one). So I had the same problem. And I solved just with a similar code.

    Sub DIARIOAJUSTARVENTANA()
    '
    ' DIARIOAJUSTARVENTANA Macro
    '

    '
    ActiveSheet.Unprotect
    Application.Goto Reference:="AJUSTADOR"
    ActiveWindow.Zoom = True
    ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
    False, AllowFormattingCells:=True
    ActiveSheet.EnableSelection = xlUnlockedCells
    Range("A4").Select
    Selection.End(xlDown).Select
    SendKeys "{down}"
    End Sub

    In my case, the row "4" is the first data row of my spreadsheet. 1, 2 and 3 are frozen.

    These days I found that hiding the row and column headings I had more space on my screen, and less useless information in my eyes. So I did that.
    But for my surprise, when I execute my "DIARIOAJUSTARVENTANA" macro, it keeps the space needed for the row title on the right of the screen, what results on showing me part of a column that is out of the interest area.

    I pasted a view of my screen here. The green area on the right is not part of the interest area. The only way I have found to solve it is to select "Show Headings" again.


    How to feet the zoom I desire without headings?

    Captura.JPG

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro or VBA code for runing solver on range of cells automatically
    By igor7 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-25-2013, 08:46 AM
  2. VBA Code To Display Email Instead Of Automatically Send
    By alulla in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-28-2013, 01:59 PM
  3. How to display selected range of cells in Textbox1 using VBA code
    By sreekanth446 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2012, 11:40 PM
  4. Replies: 2
    Last Post: 03-17-2011, 08:55 PM
  5. [SOLVED] Setting Sheet Display Zoom Magnification in VBA
    By Kevin in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-16-2005, 04:06 PM

Tags for this Thread

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