1

I have an excel sheet with variable number of entries in the column A. Sample:

402110000027547  97517161579      IDLE              402-11-150
402110000013260  97517117011      IDLE              402-11-190
402110000033664  97517125759      IDET              402-11-21

I want to execute text-to-columns and put these values in separate columns (A, B, C & D). Any help is appreciated.

2
  • Is your input file is in CSV format? Commented May 30, 2015 at 6:28
  • No. I am using some other code to populate an excel worksheet. So its an excel workbook we're talking about. Commented May 30, 2015 at 6:29

1 Answer 1

2

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/

Sign up to request clarification or add additional context in comments.

1 Comment

Self help is the best help! Good Luck!

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.