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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wraps or breaks in chart label using vba

Status
Not open for further replies.

NaughtyPine

Programmer
Nov 14, 2006
10
CA
Hi, I have a label that I would like to have wrap. See below

Current Label:
text 1 - text 2 - text 3

I would like
Text 1
Text 2
Text 3


How would I do this with vba?
 


Hi,

In a cell
[tt]
Current Label: ="text 1"&Char(10)&"text 2"&Char(10)&"text 3"
[/tt]
using VBA
Code:
    s = "text 1 - text 2 - text 3"
    s = Replace(s, " - ", vbLf)
    MsgBox s


Skip,

[glasses] [red][/red]
[tongue]
 
In my case the label is not part of a single cell but as part of combining 3 individual cells.
 



Code:
YourLabel.text = [A1].value & vblf & [B1].value & vblf & [C1].value
'or
YourLabel.text = Cells(1,1).value & vblf & Cells(1,2).value & vblf & Cells(1,3).value


Skip,

[glasses] [red][/red]
[tongue]
 


Suppose you describe what you are trying to accomplish.

From the hip, I'd suggest making a cell that combinds the 3 as I originally suggested. Then activate the chart lable, enter = in the Formula Bar and select the newly created cell.

Skip,

[glasses] [red][/red]
[tongue]
 
I would but the client requires that the chart be developed in this manner.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top