-
naming charts
Hi,
I used the following code to create a chart:
With shtMain.ChartObjects.Add _
(Left:=20, Width:=430, Top:=170, Height:=225)
.Chart.SetSourceData source:=Sheets("Results").Range("$d$2:$e$" & rowCount)
.Chart.ChartType = xlColumn
End With
and it works fine for creating the chart but on the right hand side of the chart is "Series 1".
I can't figure out how to get rid of that or to get a title to display on my chart.
Thanks
Don
-
try:[vba]With shtMain.ChartObjects.Add _
(Left:=20, Width:=430, Top:=170, Height:=225)
.Chart.SetSourceData Source:=Sheets("Results").Range("$d$2:$e$" & RowCount)
.Chart.ChartType = xlColumn
.Chart.Legend.Delete
.Chart.SetElement (msoElementChartTitleCenteredOverlay)
.Chart.ChartTitle.Text = "My Title"
' With .Chart.ChartTitle.Format.TextFrame2.TextRange
' .Characters.Text = "My Title"
' With .Characters(1, 8)
' With .ParagraphFormat
' .TextDirection = msoTextDirectionLeftToRight
' .Alignment = msoAlignCenter
' End With
' With .Font
' .BaselineOffset = 0
' .Bold = msoTrue
' .NameComplexScript = "+mn-cs"
' .NameFarEast = "+mn-ea"
' .Fill.Visible = msoTrue
' .Fill.ForeColor.RGB = RGB(0, 0, 0)
' .Fill.Transparency = 0
' .Fill.Solid
' .Size = 18
' .Italic = msoFalse
' .Kerning = 12
' .Name = "+mn-lt"
' .UnderlineStyle = msoNoUnderline
' .Strike = msoNoStrike
' End With
' End With
' End With
End With
[/vba] I recorded a macro, tweaked it a bit. The red lines are what you asked for. The commented-out lines where also recorded but you may find they're not needed.
I was using Excel 2010.
p45cal
Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.
-
thanks p45cal. exactly what I was looking for!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules