Split data into adjacent cells upon entry EXCEL

Viewed 26

I am currently trying to split data in excel that has been entered in from an external source. The external source puts all the data into one cell. I would like this data to be split based on the spaces between the information. I have a macro that splits all the data in the sheet but if the there is any data that is already split it gets deleted.

Is there a way to run a macro like this when data is entered without user input?

Below is the macro Sub splits()

Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.TextToColumns Destination:=Range("A2"), DataType:=xlDelimited, _
    TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, FieldInfo _
    :=Array(Array(1, 1), Array(2, 1), Array(3, 3), Array(4, 1), Array(5, 3), Array(6, 1), _
    Array(7, 1)), TrailingMinusNumbers:=True
Columns("C:C").Select
Selection.NumberFormat = "m/d/yyyy"
Columns("E:E").Select
Selection.NumberFormat = "m/d/yyyy"

End Sub

0 Answers
Related