Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename items on an Excel Graph

Status
Not open for further replies.

TimPen

Technical User
Mar 28, 2011
41
ZA
If I insert an "X" Axis label to a graph, the macro recorder gives me:
ActiveChart.ChartArea.Select
ActiveChart.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
ActiveChart.Axes(xlCategory, xlPrimary).AxisTitle.Text = "X Axis Title"
Selection.Format.TextFrame2.TextRange.Characters.Text = "X Axis Title"
With Selection.Format.TextFrame2.TextRange.Characters(1, 12).ParagraphFormat
.TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter
End With

That's great, but the "X" Axis label is called "TextFrame2".
How can I rename this?
I foresee running into problems referencing items on a graph usinf names like this
 


hi,

faq707-4811

Check out the SeriesCollection object.

Also you can turn on your macro recorder, select the SOURCE DATA format in the chart and CHANGE the x-axis title.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top