[VBA ] 讀取另一個Excel裡的資料然後排列

看板Visual_Basic作者 (Keep The Faith)時間9年前 (2015/09/16 00:41), 編輯推噓0(003)
留言3則, 1人參與, 最新討論串1/1
共有兩個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 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.224.85.208 ※ 文章網址: https://www.ptt.cc/bbs/Visual_Basic/M.1442335310.A.62F.html

09/16 08:12, , 1F
用cells(r, c)便不用拼英文字母了
09/16 08:12, 1F

09/16 08:13, , 2F
看起來你的區域是連續的 應該可以用copy/paste
09/16 08:13, 2F

09/16 08:14, , 3F
這一頁就有範例 https://goo.gl/o70AAq
09/16 08:14, 3F
文章代碼(AID): #1L-4fEOl (Visual_Basic)
文章代碼(AID): #1L-4fEOl (Visual_Basic)