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?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,582
Members
449,039
Latest member
Arbind kumar

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
Back
Top