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 .

5
  • Please provide some code. What have you tried so far? What do expect your code to do? What does it actually do? Commented Mar 25, 2019 at 12:03
  • 3
    You don't have to use code - Look under Data, Text to Columns, Delimited and tick comma Commented Mar 25, 2019 at 12:08
  • 2
    @HarassedDad, those delimiters look like semi-colons. Commented Mar 25, 2019 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. Commented Mar 25, 2019 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. Commented Mar 25, 2019 at 12:14

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.