How to use this code

hmk

Active Member
Joined
Jun 8, 2004
Messages
423
How to use this code of Pearson and where to put it exactuly

Code:
Sub ZoomToRange(ByVal ZoomThisRange As Range, _
    ByVal PreserveRows As Boolean)

Dim Wind As Window

Set Wind = ActiveWindow
Application.ScreenUpdating = False
'
' Put the upper left cell of the range in the top-left of the screen.

'Application.Goto ZoomThisRange(1, 1), True
ZoomToRange ZoomThisRange:=Range("F20:K40"), PreserveRows:=True

With ZoomThisRange
    If PreserveRows = True Then
        .Resize(.Rows.Count, 1).Select
    Else
        .Resize(1, .Columns.Count).Select
    End If
End With

With Wind
    .Zoom = True
    .VisibleRange(1, 1).Select
End With

End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,223,165
Messages
6,170,465
Members
452,329
Latest member
Irefsports

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