+ Reply to Thread
Results 1 to 11 of 11

Carriage returns (Enter) in a range

Hybrid View

  1. #1
    Forum Expert
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,513

    Re: Carriage returns (Enter) in a range

    Sub test()
    Dim y(), rg As Range, x, a, s, rw&, ii As Long, i As Long
        Set rg = Range("A1", Cells(Rows.Count, 1).End(3))
        x = rg.Value
        ReDim y(1 To rg.Rows.Count, 1 To 1)
        For ii = 1 To rg.Rows.Count
            rw = rw + 1
            a = Split(x(ii, 1), Chr(10))
                     For i = 0 To UBound(a, 1)
                           s = IIf(s = "", a(i), s & " " & a(i))
                     Next i
           y(rw, 1) = s: s = ""
        Next ii
     rg.Resize(UBound(y, 1), 1).Value = y
    End Sub
    Last edited by daboho; 02-07-2018 at 11:40 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Carriage Returns when concatenating
    By Wendy Collins in forum Excel General
    Replies: 2
    Last Post: 11-17-2011, 01:48 PM
  2. Carriage Returns
    By Highbury_White in forum Excel General
    Replies: 3
    Last Post: 02-24-2010, 10:09 AM
  3. How Do I Get Rid of Carriage Returns?
    By Ocean Zhang in forum Excel General
    Replies: 23
    Last Post: 07-02-2009, 10:49 AM
  4. Carriage returns in the formula bar?
    By rubeus in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-06-2006, 02:00 PM
  5. Delete Carriage Returns
    By Andre in forum Excel General
    Replies: 4
    Last Post: 12-01-2005, 07:35 PM
  6. Replies: 3
    Last Post: 11-17-2005, 03:10 PM
  7. VBA: Concatenate with carriage returns
    By Rob in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2005, 09:05 AM
  8. Carriage returns
    By tracyt620 in forum Excel General
    Replies: 1
    Last Post: 07-07-2005, 09:52 AM

Tags for this Thread

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