VBA for chart title issue

G

Guest

I have the following macro to modify a chart title if "mypattern" is changed.
I'm having one problem though. At the place where I have vbnewline in the
mypattern code, it appears that it's displaying 2 line breaks. How do I fix
this?

Thanks,
Barb Reinhardt

Public Sub SetChartTitle(WS As Worksheet, mypattern As String)
Dim objCht As ChartObject

mypattern = WS.Name & vbNewLine & "Division Target " & mypattern & " Days"
For Each objCht In WS.ChartObjects
With objCht
.Chart.ChartTitle.Text = mypattern
End With
Next objCht
End Sub
 
A

Andy Pope

Hi,

It would appear that both CarriageReturn and LineFeed both cause a new line
in the title.
Use either vbCR or vbLF instead of vbNewLine

Cheers
Andy
 
G

Guest

Thanks, that did it!

Andy Pope said:
Hi,

It would appear that both CarriageReturn and LineFeed both cause a new line
in the title.
Use either vbCR or vbLF instead of vbNewLine

Cheers
Andy
 

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