excelvbatext-to-column

Excel Vba split multiple cells into columns


My file has multiple lines (72000+) written like this:

UNIX timestamp;User id;In/Out

This homework is about a parking lot. My problem is how do I split all col A into 3 other cols (like B, C and D). I found the split function but I not understanding how to do a loop that cycles all rows and split the text to the other columns .


Solution

  • Assuming the data starts in cell A1:

    Sub Parser()
        Dim cell As Range
        For Each cell In Range("A:A")
            If cell.Value = "" Then Exit Sub
            Range(cell.Offset(0, 1), cell.Offset(0, 3)).Value = Split(cell, ";")
        Next cell
    End Sub