Kapat

Zoom The Selected Range In Excel Sheet

magnifying selected cell Magnifying The Selected Cells

A 1.40-fold larger image of the selected range is created through VBA codes that we added to the Worksheet_SelectionChange procedure of the sheet. Thus, the values in the selected cell or field can be read and examined more easily.

excel zoom range

When an empty cell in sheet is selected, the image is removed and the procedure is terminated.

VBA codes that ensured we create zoom image for the selected range : excel vba create zoom image

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim selc As Range, cell As Range, Zoom_In As Single
    Set selc = Selection
    Zoom_In = 1.4                    'Zoom rate
    
  For Each cell In Selection         'If there are blank cells in selection, shapes are deleted and ended method
        If cell.Value = Empty Then
        Call remove_picture
        GoTo here:
        Exit Sub
        End If
  Next
   
 Call remove_picture             'Remove any existing zoom pictures
  Application.ScreenUpdating = False
    selc.CopyPicture Appearance:=xlScreen, Format:=xlPicture      'Create zoom picture
    ActiveSheet.Pictures.Paste.Select
        With Selection
        .Name = "Zoom_Cells"
        With .ShapeRange
            .ScaleWidth Zoom_In, msoFalse, msoScaleFromTopLeft
            .ScaleHeight Zoom_In, msoFalse, msoScaleFromTopLeft
        With .Fill
             .ForeColor.SchemeColor = 44
             .Visible = msoTrue
             .Solid
             .Transparency = 0
            End With
        End With
    End With
 
here:
    selc.Select
    Application.ScreenUpdating = True
    Set selc = Nothing
End Sub

Sub remove_picture()              'Remove any existing zoom pictures
Dim k As Object
For Each k In ActiveSheet.Pictures
        If k.Name = "Zoom_Cells" Then
            k.Delete
        End If
    Next
End Sub

By changing the Zoom_In value in the codes, different zoom ratios can be achieved. excel zoom cell Zoom_In = 1.4

📥 Download sample workbook


Zoom The Selection By Increasing The Font Size

In our other template, only the font size of the selected range is enlarged 1.5 fold. When any blank cell is selected,font size will revert to its original size.

excel zoom selection

📥 Download sample workbook