Skip to content

Instantly share code, notes, and snippets.

@meganmcchesney
Created February 13, 2013 20:02
Show Gist options
  • Save meganmcchesney/4947699 to your computer and use it in GitHub Desktop.
Save meganmcchesney/4947699 to your computer and use it in GitHub Desktop.
Lines2Rows Macro breaks apart a cell based on a certain character, then inserts everything that is broken up into separate rows. Run from VBA, "Run Macro"
Sub Lines2Rows()
Dim rList As Range, rCell As Range
Dim lRow As Long
Dim vText As Variant
Set rList = Range("B1", Range("B" & Rows.Count).End(xlUp)) ' list
lRow = 1
For Each rCell In rList
If rCell <> "" Then
vText = Split(rCell, ";")
Range("H" & lRow).Resize(1 + UBound(vText)).Value = Application.Transpose(vText)
lRow = lRow + UBound(vText) + 1
End If
Next rCell
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment