+ Reply to Thread
Results 1 to 2 of 2

Macro to split the text in the cell to different cells ( as per enclosure )

Hybrid View

  1. #1
    Registered User
    Join Date
    12-23-2008
    Location
    Chennai,India,Tamilnadu
    Posts
    70

    Exclamation Macro to split the text in the cell to different cells ( as per enclosure )

    Dear Sirs,

    I need a help to write a macro, to split the text in a cell to different cells.

    I have enclosed the attachment for more clarification.

    Please do the needful.

    Thanks
    Regards
    M.Velmurugan
    Attached Files Attached Files

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to split the text in the cell to different cells ( as per enclosure )

    Hi mvel_sky
    Try this
    Option Explicit
    Sub Split_Text()
        Dim NR As Long
        Dim sp As Variant
    
        sp = Split(Range("C5"), "*")
        sp = RemItem(sp, 0)
    
        Range("D5").Resize(UBound(sp) + 1, 1).Value = Application.WorksheetFunction.Transpose(sp)
    End Sub
    
    Function RemItem(sp As Variant, n As Long) As Variant
    ' From http://excel.bigresource.com/Track/excel-X6MbfKzM/
        Dim i As Long
        For i = n + 1 To UBound(sp) - LBound(sp)
            sp(i - 1) = sp(i)
        Next i
        ReDim Preserve sp(LBound(sp) To UBound(sp) - 1)
        RemItem = sp
    End Function
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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