Home > Blockchain >  Text to columns - issue with commas
Text to columns - issue with commas

Time:11-25

I am trying to seperate my columns with vba. This is how my data looks:

first row:

Time,[CB:01:4A:7D:06:2D] Thermometer_0,[E5:39:8E:7F:E4:11] Thermometer_0,[F1:89:F8:3A:EA:63] Thermometer_0,[F7:C6:4A:56:E4:23] Thermometer_0

second row:

11/23/2021 10:50,,,,20.9

That means that I need to have 11/23/2021 10:50 in the first column (Time), second, third and fourth are empty, and in the fifth value 20.9. There are variations for the second row.

Currently I am trying with this code:

Sub TextToCol3()
   Range("A1:A135").TextToColumns , xlDelimited, xlDoubleQuote, True, , , True, True, True
End Sub

But this just ignore the empty spaces between commas, and creates only two columns.

CodePudding user response:

Please, test the next way:

Range("A1:A135").TextToColumns DataType:=xlDelimited, ConsecutiveDelimiter:=False, Comma:=True

If ConsecutiveDelimiter = True, the consecutive delimiters are considered as one delimiter...

  • Related