Add value when recording a macro

G

Guest

Hello,

I recorded a macro to create a bar chart - I checked the checkbox to add the
values. Stopped recording and showed me the chart with the values. If I run
the macro again, it does not display the value. What is the code I need to
always display the value?
 
D

Debra Dalgleish

After you create the chart, turn on the macro recorder again
Select the chart, and choose Chart>Chart Options
On the Data Labels tab, check Values
Click OK
Turn off the macro recorder

In the recorded code, you'll see a line similar to this:

ActiveChart.ApplyDataLabels AutoText:=True, LegendKey:=False, _
HasLeaderLines:=False, ShowSeriesName:=False, _
ShowCategoryName:=False, _
ShowValue:=True, ShowPercentage:=False, ShowBubbleSize:=False


Copy that line and paste it in your original macro code, after the lines
of code that create the chart.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top