I have an excel sheet with variable number of entries in the column A. Sample:
402110000027547 97517161579 IDLE 402-11-150
40211000001326
I got it working using this code:
With sheet
.Columns(1).TextToColumns( _
Destination:=.Cells(1, 1), _
DataType:=Excel.XlTextParsingType.xlDelimited, _
TextQualifier:=Excel.XlTextQualifier.xlTextQualifierDoubleQuote, _
ConsecutiveDelimiter:=False, _
TAB:=False, _
Semicolon:=False, _
Comma:=False, _
Space:=True, _
Other:=False, _
TrailingMinusNumbers:=False)
End With
Thanks to this page http://www.siddharthrout.com/index.php/2018/06/28/excel-text-to-columns-from-vb-net/