I need to count the number of commas within a cell so I can insert the proper number of rows below before I parse the value into separate rows. For instance,
box, animal, elephant, wood, storage
I need to know that there are 4 commas.
So I can then insert 4 rows below the line and run the following macro:
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
to end up with
box
animal
elephant
wood
storage
thanks for any/all help!
box, animal, elephant, wood, storage
I need to know that there are 4 commas.
So I can then insert 4 rows below the line and run the following macro:
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
to end up with
box
animal
elephant
wood
storage
thanks for any/all help!