+ Reply to Thread
Results 1 to 6 of 6

Multiple lines in single cell

  1. #1
    Forum Contributor
    Join Date
    01-19-2006
    Posts
    142

    Multiple lines in single cell

    Hi all,

    Anyone know how to input 2 strings from vba into a single cell, like the following;

    String 1
    String 2

    Please Login or Register  to view this content.
    The code above puts the strings into the cell without a break.

    Any help appreciated!!

    Taa laa

  2. #2
    Robin Hammond
    Guest

    Re: Multiple lines in single cell

    activecell.Value = "a" & chr(10) & "b"

    Robin Hammond
    www.enhanceddatasystems.com

    "gti_jobert" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Hi all,
    >
    > Anyone know how to input 2 strings from vba into a single cell, like
    > the following;
    >
    > String 1
    > String 2
    >
    >
    > Code:
    > --------------------
    >
    > Cells(1, 1).Value = "M/C Group By: " & GroupMachine & " " & "Shift Group
    > By: " & GroupShift
    >
    > --------------------
    >
    >
    > The code above puts the strings into the cell without a break.
    >
    > Any help appreciated!!
    >
    > Taa laa
    >
    >
    > --
    > gti_jobert
    > ------------------------------------------------------------------------
    > gti_jobert's Profile:
    > http://www.excelforum.com/member.php...o&userid=30634
    > View this thread: http://www.excelforum.com/showthread...hreadid=510524
    >




  3. #3
    Forum Contributor
    Join Date
    01-19-2006
    Posts
    142
    Hey,

    I had originally did as you tried but got a square inbetween my strings within the cell, found out that the cell first has to be formatted using 'Wrap Text box'.

    Taa

  4. #4
    Jim May
    Guest

    Re: Multiple lines in single cell

    Range("A1") = "String1" & Chr(10) & "String2"

    maybe,

    "gti_jobert" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Hi all,
    >
    > Anyone know how to input 2 strings from vba into a single cell, like
    > the following;
    >
    > String 1
    > String 2
    >
    >
    > Code:
    > --------------------
    >
    > Cells(1, 1).Value = "M/C Group By: " & GroupMachine & " " & "Shift Group
    > By: " & GroupShift
    >
    > --------------------
    >
    >
    > The code above puts the strings into the cell without a break.
    >
    > Any help appreciated!!
    >
    > Taa laa
    >
    >
    > --
    > gti_jobert
    > ------------------------------------------------------------------------
    > gti_jobert's Profile:
    > http://www.excelforum.com/member.php...o&userid=30634
    > View this thread: http://www.excelforum.com/showthread...hreadid=510524
    >
    >




  5. #5
    Forum Contributor
    Join Date
    01-10-2006
    Location
    Ahmedabad, India
    MS-Off Ver
    Office 2000
    Posts
    346

    Re: Multiple lines in single cell

    Make it
    Range("A1")= String1 & CHR$(10) & String2 ( it is CHR$ not CHR )

    A V Veerkar

  6. #6
    Robert ap Rhys
    Guest

    Re: Multiple lines in single cell


    "avveerkar" <[email protected]> wrote
    in message news:[email protected]...
    >
    > ( it is CHR$ not CHR )
    >


    It's both. And there's very little to choose between the two. Chr$ is
    marginally more efficient, but will make such a disappearingly small
    improvement in an average Excel/VBA application that, in reality, it matters
    not which you use.

    Robert



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1