【发布时间】:2014-11-17 06:08:16
【问题描述】:
我想将逗号分隔值(或任何分隔符)转置为数组中的多行。我看到的大多数示例都保存到 excel 文件中的范围值中。 有没有可以指教的。
strFirstLine:
row1,row2,row3
数组中的输出,因此我可以在每一行上循环进行操作:
row1
row2
row3
这是我到目前为止的代码。我在 debug.print 部分添加了评论。
line = WorksheetFunction.Transpose(Split(strFirstLine, ","))
ctr = 0
For ctr = LBound(line) To UBound(line)
Debug.Print LBound(line) --value is 1
Debug.Print UBound(line) --value is 13
Debug.Print CStr(line(LBound(line))) --this line fails with "Subscript out of Range" error
Next ctr
如果您需要更多详细信息,请告诉我。任何想法将不胜感激!
【问题讨论】:
-
这个不需要 vba,Excel 已经免费提供了
-
转置?是的,但我需要对数据进行一些操作,因此我想将它保存在一个数组中并访问它。
标签: arrays vba excel split transpose