0

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 .

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
xPudimx
  • 11
  • 5
  • Please provide some code. What have you tried so far? What do expect your code to do? What does it actually do? – jeanggi90 Mar 25 '19 at 12:03
  • 3
    You don't have to use code - Look under Data, Text to Columns, Delimited and tick comma – Harassed Dad Mar 25 '19 at 12:08
  • 2
    @HarassedDad, those delimiters look like semi-colons. –  Mar 25 '19 at 12:12
  • 2
    You could try something like this `Range(input your range here).TextToColumns DataType:=xlDelimited, semicolon:=True` using vba to split the data into three columns or use the Text to Columns function under the Data tab. – Arjun Mar 25 '19 at 12:12
  • 1
    If using Text to Columns, you will have to change the target from A1 (the defalt) to B1 in order to fill columns B, C and D. –  Mar 25 '19 at 12:14

1 Answers1

1

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
Gary's Student
  • 95,722
  • 10
  • 59
  • 99