Dividing the Screen Unevenly between Two Workbooks

by Allen Wyatt
(last updated October 16, 2021)

1

Often when Dave has two workbooks open, he uses Arrange | Horizontal to view them simultaneously. This divides the space evenly between the two workbooks. However, it often happens that Dave would like to see only a few rows of data in one workbook and many rows in the other. He wonders if there is a convenient way to manually size the smaller workbook and have Excel fill the remaining space on the screen with the second workbook.

The manual way of doing this is one that Dave (and most other Excel users) are already familiar with: You arrange the windows horizontally, resize the top window, and then resize the bottom window. In this way you get the windows to be just the way you want in order to do your work.

If you want a more automatic way to resize the windows, you could use a macro to accomplish the task. The following macro relies on you to size the first window the way you want and then it automatically resizes the second window to take up the remaining space below the top window.

Sub UnevenSplit1()
    Dim Ht0 As Single
    Dim Ht1 As Single
    Dim Ht2 As Single
    Dim Top2 As Single

    If Windows.Count = 2 Then
        With Windows(1)
            Ht1 = .Height
            .WindowState = xlMaximized
            Ht0 = .Height
        End With
        Top2 = Ht1 + 3
        Windows.Arrange ArrangeStyle:=xlHorizontal
        With Windows(1)
            .Top = 1
            .Height = Ht1
        End With
        With Windows(2)
            .Top = Top2
            .Height = Ht0 - Ht1 - 22
        End With
        Windows(1).Activate
    End If
End Sub

The macro will only resize your workbook windows if you have only two workbooks open. If you have more or less than this, it will appear as if nothing happens.

You can take the automation another step by having the macro resize the top window, as well. The following example ends up with your top window occupying 25% of the screen and the bottom window occupying 75%.

Sub UnevenSplit()
    Dim sQtr As Single

    If Windows.Count = 2 Then
        Windows.Arrange ArrangeStyle:=xlHorizontal
        sQtr = Windows(1).Height / 2
        Windows(1).Top = 1
        Windows(1).Height = sQtr
        Windows(2).Top = sQtr + 3
        Windows(2).Height = sQtr * 3
        Windows(1).Activate
    End If
End Sub

You should also be aware that the value of this macro depends, in large part, on what you have visible in your windows. If you have the ribbons at their full vertical depth, that takes a lot of screen space. In fact, it may take so much that even though the top window occupies 25% of the screen height, it may not show any rows of your worksheet because the space is taken up by the ribbon and other interface elements.

There are two possible solutions. The first is to minimize screen elements, such as the ribbon. (Double-click on any ribbon tab in order to minimize the ribbon.) The other solution, of course, is to have the macro use different calculations to determine the final sizes of the windows.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13380) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Sending Drawing Objects to the Back or Front

Drawing objects can be placed in a document in such a way that they overlap with each other. If you want to arrange those ...

Discover More

Hiding Errors on Printouts

If there are error values in a worksheet, you may not want those error values to appear on a printout. Excel actually ...

Discover More

Selecting a Window

When you get a lot of windows open on your screen, it can sometimes be difficult to locate the one with which you need to ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Making AutoComplete Work for an Entire Column

AutoComplete is a great feature for quickly adding data to a worksheet. If you are confused by why some things are picked ...

Discover More

F4 No Longer Changes Cell References

Excel has a wide variety of keyboard shortcuts that can help make it easier to use the program. When one of those ...

Discover More

Selecting Multiple Cells by Mistake

Click on a cell and you expect the single cell to be selected. If you instead get a group of cells, it can be frustrating ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is six more than 6?

2021-10-16 10:10:19

J. Woolley

You might also be interested in My Excel Toolbox's DynamicImage macro, which is similar to Excel's Camera Tool or Home > Paste > Linked Picture. The DynamicImage macro copies a range of cells and pastes it as a dynamic image in any sheet of any workbook. In addition to cell values, the dynamic image will include visible portions of shapes or charts from the copied range. Any changes visible in the copied range will be reproduced in the dynamic image. The result is a simple dashboard.
See https://sites.google.com/view/MyExcelToolbox/
and https://excelribbon.tips.net/T010521_Using_the_Camera_in_VBA.html


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.