You are on page 1of 1

Sub SplitCells()

Dim iRow
Dim astr()

As Long
As String

Application.ScreenUpdating = False
For iRow = Cells(Rows.Count, "A").End(xlUp).Row To 1 Step -1
If InStr(Cells(iRow, "B").Value, ",") Then
astr = Split(Cells(iRow, "B"), ",")
Rows(iRow + 1).Resize(UBound(astr)).Insert
With Rows(iRow).Resize(UBound(astr) + 1)
.Rows(1).Copy Destination:=.Columns(1)
.Columns(2).Value = WorksheetFunction.Transpose(astr)
End With
End If
Next iRow
Application.ScreenUpdating = True
End Sub

You might also like