简单的VBA excel从文本文件中select特定的部分
我的文本文件包含类似的东西
A B C D
我只想selectb和c
到目前为止,我已经使macros可以读取所有数据(a,b,c,d)
With ws.QueryTables.Add("TEXT;" & File, ws.Cells(1, 1)) .FieldNames = True .AdjustColumnWidth = True .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = False .TextFileCommaDelimiter = True .TextFileColumnDataTypes = columnFormats .Refresh End With
我只需要添加selectb和c?
尝试添加:
.TextFileColumnDataTypes = Array(9, 1, 1, 9)
其中9代表跳过