Excel Guides

Pulling AutoShape Text from a Worksheet Cell in Excel

When working with shapes in Excel, you may want to pull the text from a particular cell in your worksheet and use it as the shape's text. This can be done using a simple macro.

First, select the shape that you want to add the text to. Then, open the Visual Basic Editor (VBE) by pressing Alt+F11 on your keyboard. In the VBE, double-click on the sheet that contains the cell with the text you want to use.

Paste the following code into the code window:

Sub PullTextFromCell()

    Dim strText As String

    'Get the text from the cell
    strText = ActiveSheet.Range("A1").Value

    'Add the text to the shape
    ActiveShape.TextFrame.Characters.Text = strText

End Sub

In this code, we are pulling the text from cell A1 on the active sheet. You can change this to any cell reference that you like. We are then adding this text to the active shape.

To run this code, press F5 on your keyboard or click on Run > Run Sub/UserForm in the VBE menu.

Move beyond 

Excel

Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.