Excel文本到列使用VB.net [英] Excel Text-to-Columns using VB.net

查看:122
本文介绍了Excel文本到列使用VB.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  402110000027547 97517161579 

我有一个excel表,列A中有可变数量的条目。 IDLE 402-11-150
402110000013260 97517117011 IDLE 402-11-190
402110000033664 97517125759 IDET 402-11-21

我想执行文本到列,并将这些值放在单独的列(A,B,C和D)中。任何帮助不胜感激。

解决方案

我使用这段代码工作:



$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $
$ C $ Excel.XlTextParsingType.xlDelimited,_
TextQualifier:= Excel.XlTextQualifier.xlTextQualifierDoubleQuote,_
ConsecutiveDelimiter:= False,_
TAB:= False,_
分号:= False, _
逗号:= False,_
空格:= True,_
其他:= False,_
TrailingMinusNumbers:= False)
结束
感谢这个页面
https://siddharthrout.wordpress.com/2012/06/29/excel-text-to-columns-from -vb-net /


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.

解决方案

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 https://siddharthrout.wordpress.com/2012/06/29/excel-text-to-columns-from-vb-net/

这篇关于Excel文本到列使用VB.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆