Possibly autofit excel to user display

goofy78270

Well-known Member
Joined
May 16, 2007
Messages
555
I was wondering if it is possible to autofit an excel sheet to the users display.

We publish are looking to publish a product matrix to our Intranet but a concern from the reviewers is that since users have different display resolutions, could we possibly autofit the display, by setting the default to zoom to where the complete matrix heading fits on the screen - Columns A-L

I know how to adjust the zoom but how do I check to see what the users resolution is?
 

Some videos you may like

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

MorganO

Active Member
Joined
Nov 21, 2006
Messages
483
Here is some code I came across awhile back and use in one of my applications to zoom a sheet to a users screen. You only need to send the subroutine the cell reference (row and column) of the lower-right corner cell of the area you want visible on the screen, and the routine will zoom to a best fit to keep that cell on the screen.

Hope this helps.

Take care.

Owen

Code:
Sub ZoomToFit(BottomRow, RightColumn)

'do not let the zoom go lower than 25% or greater than 200%

    With ActiveWindow
          .Zoom = 100
        'zoom out
        Do While Not Intersect(.VisibleRange.Cells, Range(Cells(BottomRow, RightColumn), Cells(BottomRow, RightColumn)).Cells) Is Nothing
            .Zoom = .Zoom + 5
            If .Zoom > 200 Then
              .Zoom = 200
              Exit Sub
            End If
        Loop

        'zoom in
        Do While Intersect(.VisibleRange.Cells, Range(Cells(BottomRow, RightColumn), Cells(BottomRow, RightColumn)).Cells) Is Nothing
            .Zoom = .Zoom - 5
            If .Zoom < 25 Then
              .Zoom = 25
              Exit Sub
            End If
        Loop  
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,123,398
Messages
5,601,440
Members
414,450
Latest member
Cassy_sn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top