Author: Oscar Cronquist Article last updated on June 19, 2013

A blog reader asks:

I need an excel 2010 macro, where I can enter a number (value) into cell B1, click on button below, and the page will automatically go to the corresponding shape, with that same number.


Find shape

  1. Enter a number in cell B1.
  2. Click "Find shape" button

Find shape1

The macro finds a shape.

VBA Code

Sub FindShape()
Dim sht As Worksheet
Dim shp As Shape
For Each sht In ActiveWorkbook.Worksheets
    For Each shp In sht.Shapes
        If shp.TextFrame.Characters.Text = Worksheets("Sheet1").Range("B1").Value Then
            ActiveWindow.ScrollRow = shp.TopLeftCell.Row
            ActiveWindow.ScrollColumn = shp.TopLeftCell.Column
            Exit Sub
        End If
    Next shp
Next sht
End Sub

Download excel *.xlsm file
Locate a shape.xlsm