Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 02-07-2018, 01:08 PM
NoSparks NoSparks is offline Split data in cells and duplicate rows Windows 7 64bit Split data in cells and duplicate rows Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Assuming data starts in A2, a comma is the separator and no event code for the sheet,
on a copy of your workbook, paste this into a standard module and give it a try, alter the sheet name as required
Code:
Sub Testing_1()

Dim lr As Long, i As Integer, j As Integer, ray

Application.ScreenUpdating = False

With Sheets("Sheet1")
    lr = .Range("A" & Rows.Count).End(xlUp).Row
    For i = lr To 2 Step -1
        ray = Split(.Cells(i, 4).Value, ",")
        If UBound(ray) > 0 Then
            .Range("A" & i).Resize(, 4).Copy
            .Range("A" & i + 1).Resize(UBound(ray), 4).Insert xlShiftDown
            For j = LBound(ray) To UBound(ray)
                .Cells(i, 4).Offset(j).Value = Trim(ray(j))
            Next j
        End If
    Next i
End With
    
Application.CutCopyMode = False
Application.ScreenUpdating = True

End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find duplicate rows in a huge excel file containing 500000 rows Stc25234 Excel Programming 2 06-23-2017 10:51 AM
eliminating blan rows between cells in a column cantaining data FUGMAN Excel Programming 6 03-01-2017 07:35 AM
Split data in cells and duplicate rows Merge duplicate rows but retain data from one column Willem113 Excel 1 09-21-2016 05:42 PM
how to split merged data into vertical saperate cells cheekugreat Excel 5 10-11-2014 05:53 AM
Losing rows when pasting split cells Gitley Word Tables 1 01-15-2013 07:49 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft