PDA

View Full Version : [SOLVED:] Help need to inser Carriage return in chart series name.



LutonBarry
06-23-2014, 02:43 AM
Folks I hope you can help. I am familiar with the method to insert a carriage return in to a date on for example the x axis of a graph.

01/01/2004 (Entered in cellA1) if I enter in the chart series cell =TEXT($A1,"mmm")&CHAR(13)&TEXT($A1,"yy") it will display the date in the format Jan on one line and 04 on the line below in the chart.

Question is how do I that or can I do that with free text such as that below where a space occurs but in a different place.

Ldn 3rd


Ldn F/C


Ldn SS





OAB


Res Con


RTSS Eur

Thanks for any assistance.

mancubus
06-23-2014, 02:51 AM
hi.
if delimeter is a space:


Join(Split(Range("A1").Value, " "), vbCr)

since "space" is the default delimeter of Split Function:

Join(Split(Range("A1").Value), vbCr)

LutonBarry
06-23-2014, 03:30 AM
Mancubus, thanks for the reply but I'm lost how would I actually use that formula? Would I run it from the sheet ot open a VBA module?

mancubus
06-23-2014, 04:06 AM
welcome.

you shuld not. because you started the thread saying "i'm familiar with..." :)

this is why i assumed you knew everthing but converting a single line string to multi line string.

so the line i posted is just a pointer to converting a single line string to multi line string with cr.

A1 is from the example in the second paragraph. so change it to actual range, variable, whatever.

here is an example:



Dim chtSerName As String
chtSerName = Join(Split("RTSS Eur"), vbCr)
ActiveChart.SeriesCollection(1).Name = chtSerName


with a oneliner:

ActiveChart.SeriesCollection(1).Name = Join(Split("RTSS Eur"), vbCr)

LutonBarry
06-24-2014, 06:11 AM
Mancubus,
Thansk I understand and have it working. I cannot sometimes (most times actually) see the wood for the trees.

mancubus
06-24-2014, 07:08 AM
you're welcome.

that's valid for all of us (i think). :)