I have have the following data in excel:
a, b, c
d
e
f, g
h
i
with each row, representing a row and in one cell.
I would like to convert it to:
a
b
c
d
e
f
g
h
i
I am using the following macro, but I can't get the autosize to do an insert, instead of overriding the cell values. Any help is appreciated.
Sub SplitCells()
Dim i As Long
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
For i = 1 To Selection.Rows.Count
Dim splitValues As Variant
splitValues = split(Selection.Rows(i).Value, ",")
Selection.Rows(i).Resize(UBound(splitValues) - LBound(splitValues) + 1).Value = Application.Transpose(splitValues)
Next i
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub
See Question&Answers more detail:os