VBA: Only import selected columns of a csv file

前端 未结 1 526
夕颜
夕颜 2021-01-15 06:10

Using VBA I import a csv file into excel from Yahoo Finance containing 7 comma separated values per row. I would like to only import the first and 5th comma separated value

相关标签:
1条回答
  • 2021-01-15 06:57

    You can supply an array as the FieldInfo parameter to TextToColumns

    This will hide columns 2,3,4,6,7

    .TextToColumns FieldInfo := Array(Array(1, 1), Array(2, 9), Array(3, 9), Array(4, 9), Array(5, 1), Array(6, 9), Array(7, 9))

    1 = xlGeneralFormat
    9 = xlSkipColumn

    0 讨论(0)
提交回复
热议问题