Results 1 to 10 of 14

Thread: Split the contents from single cell into multiple cell in excel 2010

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    15
    Select the cell or cells that you want to split apart and then run this macro...
    Code:
    Sub SplitSelectedCellsDown()
      Dim Cell As Range, Sentences() As String
      For Each Cell In Selection
        Sentences = Split(Cell.Value & vbLf, vbLf)
        Cell.Offset(1).Resize(UBound(Sentences)) = Application.Transpose(Sentences)
      Next
    End Sub

  2. #2
    Junior Member
    Join Date
    Apr 2015
    Posts
    8
    Rep Power
    0
    Hi Rick,

    Thanks a lot for your solution.

    It reduces the 50% of my work, still i have to modify few things as like below,

    Input: Cell1 contains 3 sentences,

    Step1: Am santhosh from Coimbatore.
    Step2: Am working as testing Engineer.
    Step3: I need solution for this.


    I need to split the above cell1 into 3 cells below (Cell2, cell3, cell4). Your code works here but..
    Before executing the macro given by you, i need to create 3 empty cells below that to get the proper output. Otherwise its overwriting the existing content.

    Any solution to create the 3 empty cells first (Based on the number of sentences available in cell1) and then seperate the contents as like your macro.

  3. #3
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    15
    This revised macro should work for you...
    Code:
    Sub SplitSelectedCellsDown()
      Dim Cell As Range, Sentences() As String
      For Each Cell In Selection
        Sentences = Split(Cell.Value & vbLf, vbLf)
        Cell.Offset(1).Resize(UBound(Sentences)).Insert xlShiftDown
        Cell.Offset(1).Resize(UBound(Sentences)) = Application.Transpose(Sentences)
      Next
    End Sub

Similar Threads

  1. Replies: 3
    Last Post: 02-11-2014, 08:31 PM
  2. Replies: 3
    Last Post: 11-22-2013, 08:22 AM
  3. Replies: 1
    Last Post: 08-23-2013, 05:19 AM
  4. Replies: 5
    Last Post: 01-12-2013, 02:49 AM
  5. Concatenate Multiple Lookup Values in Single Cell
    By Admin in forum Download Center
    Replies: 4
    Last Post: 04-06-2012, 09:07 PM

Posting Permissions

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