Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Pulling AutoShape Text from a Worksheet Cell.
Written by Allen Wyatt (last updated October 16, 2021)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365
Shapes are a great way to easily add simple graphics to your worksheets. Better still, shapes are like text boxes, in that they can contain text.
If you know how to add text to a text box, you already know how to add text to a shape. What you may not know how to do is to make that text dynamic, so that it is based on the text stored in a cell of your worksheet. Follow these steps:
That's it; the text in the shape is now tied to the text of the cell you specified in step 3. If you change that text, then the text in the shape changes, as well.
You should note that it is only the text of the cell that appears in the shape; Excel doesn't reflect, in the shape, any formatting that you may have applied to the text in the worksheet. If you want to format how the text appears in the shape, you'll have to use the formatting tools that Excel provides for working with shapes.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9840) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Pulling AutoShape Text from a Worksheet Cell.
Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!
Excel makes it easy to place a graphic in a worksheet. Once there, you may want to chop off a side (or two) of the ...
Discover MoreWhen you add multiple graphic objects in a worksheet, it can often be beneficial to group those objects together. Here's ...
Discover MoreWhen you insert a shape into a worksheet, Excel does some preliminary formatting on that shape. You can subsequently make ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2021-11-08 09:32:47
Mike D.
@Michael
If you are wanting a macro to do this I am assuming this will happen more than once in your sheet.
If that is the case I would suggest adding an 'Input Box' to J.Woolley's code.
Then you can use that variable in the code: ActiveSheet.Shapes(Box_I_Want_Change).Select
2021-11-06 12:39:03
J. Woolley
@Michael
Try this:
Dim Temp As Range
Set Temp = Selection
ActiveSheet.Shapes("Blank11").Select
Selection.Formula = "=Letter"
Temp.Select
See https://sites.google.com/view/MyExcelToolbox/
2021-11-05 12:02:47
Michael
That's great!!! But I don't want to select the shape first. I simply want to refer to the particular shape in VBA and have the text from a certain cell to be written in said shape.
if shape was named "Blank11" and Range("Letter") contained the text, how would I code for this? Emphasize that I DO NOT want to select "Blank11" first.
2021-10-18 16:06:23
Mike D.
@Roy
Click on a shape you wish to format and look at your Tab menus and you will notice a new tab, Shape Format.
Click on it and all of your object formatting tools will appear.
This tab is only visible when an object is selected.
2021-10-16 09:59:54
Roy
"... you'll have to use the formatting tools that Excel provides for working with shapes."
Um, yes. And... where are those formatting tools?
Experimenting some, I found a couple ways to format. Intriguingly, both seemed to require I delete the cell reference.
Once deleted, the last text it had shown remained as pure text. If I either cleared that out (shapes are testy about the precise way that's done, almost as bad as PDF's are), I could directly apply formats via right-click|format. And once I put the cell reference back in, it applied to everything that put in.
If I left the text, I could NOT get right-click|format to work at all, not even anything coming up with right-clicking. But if I highlighted it all and pressed Ctrl-1, I got lots of formatting options. After choosing and saving them, putting the reference back in restored it to lovely, lovely working AND with the formatting.
But nothing at all worked without the reference being removed first.
New and wonderful for me. Fixes a major hassle for me with a document the boss wanted to be as identical to a program's produced output as possible and that has some objects that may or may not be Shapes, but apparently act like them in some ways as this worked in one of them. So, while I now have 100% of what I ever wanted due to this Tip, thoughts for experiments come to mind and hopefully I shall get the chance to do them, and more soon. If so, I'll report back anything I find interesting and/or useful.
One, I just ran. Was wondering how to use a formula. Of course, it does turn out a formula in the referred to cell works as it is doing the standard thing of taking the formula's output as the value of the cell reference and putting ITS text in the Shape. But a formula in the place of a simple cell reference generates an error that does not let one save said formula. Putting the formula in a Named Range and referring to the Named Range for the reference does not work either as Excel refuses to recognize the Named Range in the Shapes cell/editing bar/whatever.
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments