Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 3,355
Default VBA for chart title issue

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

  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default VBA for chart title issue

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

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Barb Reinhardt" wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 3,355
Default VBA for chart title issue

Thanks, that did it!

"Andy Pope" wrote:

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

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Barb Reinhardt" wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedded Chart Versus Chart - ShowDetail Issue [email protected] Charts and Charting in Excel 1 May 14th 06 04:11 PM
Longer Chart Title? [email protected] Charts and Charting in Excel 0 April 30th 06 09:04 AM
Excel chart - how to assign the file name in the chart title? TGreen Charts and Charting in Excel 1 August 16th 05 10:35 AM
Pasting Objects into Chart title and Axis title Sam Charts and Charting in Excel 1 June 6th 05 08:50 PM
Chart Title LDanix Charts and Charting in Excel 2 January 17th 05 10:02 AM


All times are GMT +1. The time now is 03:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"