I have this existing macro that is splitting the values from column J and inserting each individual value separated by commas into the rows below it. With the code I have and the image below (small sample size as an example, but my data set is significantly larger), new rows will be created to allow "abc,def" to split and "def" be on its own line and "zzz, ppp" to be split and "ppp" to be on its own line but I would like to have the macro be modified to have "123" be included in the newly created row where "def" is now and the same for "456" for where "ppp" will be placed on A5.
VBA Code:
Sub SplitValues()
Dim cell as Range
Dim values() as String
Dim i as Long
For each cell in Range("J1:J100")
If cell.Value <> "" and InStr(cell.Value, ",") > 0 Then
values = Split(cell.Value, ",'")
cell.Value = Trim(values(0))
For i = 1 To UBound(values)
cell.Offset(i,0).EntireRow.Insert
cell.Offset(i,0).Value = Trim(values(i))
Next i
End if
Next cell
End sub