
Now, it the quantity is changed, the button will show the applicable text in its caption. NOTE: You might have to reapply some of the formatting after you link the button to the cell.

Click on cell E2, which has the text for the button, and press Enter.Click in the Formula Bar, and type an equal sign: =.Instead of showing the static text, “Run the Macro”, on the button, here’s how to use the dynamic text from cell E2: If the quantity is over 40, the result in cell E2 will mention the discount – “See discounted price” Link Button Text to a Cell If the quantity is 40 or less, cell E2 will show “See price”. =IF(C1<=40,”See price”, “See discounted price”) In cell E2, I’ve added another formula, to check the quantity, and show text based on that amount. The formula in the cell C11, named TotalPrice, calculates the total price of the order. In this example, a quantity is entered in cell C1, and customers get a discount if the quantity is greater than 40. Instead of using static button text though, sometimes it’s nice to have a caption that changes, based on the situation on the worksheet. Change the font colour too, if necessary, to contrast with the shape’s fill colour. I usually centre the text vertically and horizontally, and choose a bigger font size. To add a caption to a shape “button”, just select it, and start typing.Īfter you add the text, with the button still selected, use the Formatting commands on the Excel Ribbon to make the text look better. Then, to make the shape run a macro, right-click on the shape, and assign a macro to run when you click it. I like to change the Shape Effects too, and give it a round Bevel, so it looks more “button=y”. With the shape selected, you can change its height and width, other formatting options, like the fill colour and outline colour. In the Insert tab of the Excel Ribbon, click Shapes, then choose one of the shapes, and click on the worksheet, where you want to add it. Shapes give you more formatting options, so you can make your button stand out on the worksheet. Those Developer tab buttons are okay (if you like grey), but I like to use an Excel shape instead. Just choose a macro from the list, and the button is ready to use. The Form Controls button has an “Assign Macro” command that appears automatically, after you create it.

The button in the Form Controls section is easier to use than the ActiveX controls button, and cause fewer problems, from my experience. If you want to add a button, there are commands on the Developer tab, in the Insert menu on the Controls group.

There’s a button on the worksheet, and you click that to run the macro. In this example, the workbook has a macro to show the total amount of an order. See how to add the button, create its text, then link the button to cell text instead. If you have buttons or shapes on an Excel worksheet, you can get their caption text from a worksheet cell, so the text changes, based on a formula.
