Consulting

Results 1 to 6 of 6

Thread: Help need to inser Carriage return in chart series name.

  1. #1

    Help need to inser Carriage return in chart series name.

    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.

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    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)
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  3. #3
    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?

  4. #4
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    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)
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  5. #5
    Mancubus,
    Thansk I understand and have it working. I cannot sometimes (most times actually) see the wood for the trees.

  6. #6
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    you're welcome.

    that's valid for all of us (i think).
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •