[VBA ] 读取另一个Excel里的资料然后排列

楼主: licheer (Keep The Faith)   2015-09-16 00:41:48
共有两个Excel档A,B
A要去读B里面某一栏的资料,然后填在A的其中一列中
目前想到的做法是组合字段及列的名称
感觉有点麻烦
想请教有没有比较有效率的写法..谢谢
ColIdxArr = Array("D","E","F","G","H","I","J","K","L","M","N","O")
RowIdxArr = Array("3","4","5","6","7","8","9","10","11","12","13","14")
For i = 0 To 11
Sheets("Sheet1").Range(ColIdxArr(i) + "4").Formula =
"='C:\Data\[File1.xls]Sheet2'!D" + RowIdxArr(i)
Next
作者: MOONRAKER (㊣牛鹤鳗毛人)   2015-09-16 08:12:00
用cells(r, c)便不用拼英文字母了看起来你的区域是连续的 应该可以用copy/paste这一页就有范例 https://goo.gl/o70AAq

Links booklink

Contact Us: admin [ a t ] ucptt.com