Results 1 to 10 of 12

Thread: Split Upper / Lower case + concatenate rows

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Senior Member
    Join Date
    Jun 2012
    Posts
    337
    Rep Power
    14
    Code:
    Sub M_snb()
        ReDim sp(1 To Cells(1).CurrentRegion.Columns(1).SpecialCells(4).Areas.Count, 1 To 2)
        y = 1
        
        For Each ar In Cells(1).CurrentRegion.Columns(1).SpecialCells(4).Areas
            c00 = Join(Application.Transpose(ar.Offset(-1, 1).Resize(ar.Rows.Count + 1)))
            For j = 1 To Len(c00)
               If Mid(c00, j, 1) Like "[a-z]" Then
                    sp(y, 1) = Left(c00, j - 1)
                    sp(y, 2) = Mid(c00, j)
                    y = y + 1
                    Exit For
                End If
            Next
        Next
        
        Cells(20, 4).Resize(UBound(sp), UBound(sp, 2)) = sp
    End Sub

  2. #2
    Junior Member
    Join Date
    Sep 2014
    Posts
    6
    Rep Power
    0
    Quote Originally Posted by snb View Post
    Code:
    Sub M_snb()
        ReDim sp(1 To Cells(1).CurrentRegion.Columns(1).SpecialCells(4).Areas.Count, 1 To 2)
        y = 1
        
        For Each ar In Cells(1).CurrentRegion.Columns(1).SpecialCells(4).Areas
            c00 = Join(Application.Transpose(ar.Offset(-1, 1).Resize(ar.Rows.Count + 1)))
            For j = 1 To Len(c00)
               If Mid(c00, j, 1) Like "[a-z]" Then
                    sp(y, 1) = Left(c00, j - 1)
                    sp(y, 2) = Mid(c00, j)
                    y = y + 1
                    Exit For
                End If
            Next
        Next
        
        Cells(20, 4).Resize(UBound(sp), UBound(sp, 2)) = sp
    End Sub
    thanks for the effort, but in my real data set I also have ID's without blank cells below and this code isn't picking those up.

Similar Threads

  1. Excel Macro to Split Multiple Columns into rows
    By cali-novice in forum Excel Help
    Replies: 2
    Last Post: 05-16-2014, 12:34 PM
  2. Replies: 6
    Last Post: 04-13-2014, 02:31 AM
  3. Random Time Between Fixed Lower And Upper Limits
    By papabill in forum Excel Help
    Replies: 9
    Last Post: 07-22-2013, 05:01 PM
  4. Replies: 4
    Last Post: 05-01-2013, 09:49 PM
  5. Reverse name in excel with upper case,edit formula
    By shrinivasmj in forum Excel Help
    Replies: 3
    Last Post: 09-11-2012, 01:31 PM

Tags for this Thread

Posting Permissions

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