看板 Office 關於我們 聯絡資訊
軟體:EXCEL 版本:2010 您好 我用錄製巨集方式產生下列VBA指令 With ActiveSheet.QueryTables.Add(Connection:= _ filepath1, Destination _ :=Range("$A$1")) 現在我想修改產出資料儲存格放置的位置,也就是原本是在A1這個位置 但是現在我想改成動態的,我試了幾個方式,都顯示錯誤,例如: With ActiveSheet.QueryTables.Add(Connection:= _ filepath1, Destination _ :=Range(工作表1.Cells(1, 1))) With ActiveSheet.QueryTables.Add(Connection:= _ filepath1, Destination _ :=Range('工作表1'.Cells(1, 1))) With ActiveSheet.QueryTables.Add(Connection:= _ filepath1, Destination _ :=Range("'工作表1'.Cells(1, 1)")) 請教我該如何表示才是正確的呢?感謝回復 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 117.56.73.248 ※ 文章網址: https://www.ptt.cc/bbs/Office/M.1537408581.A.5CB.html
soyoso: worksheets("工作表1").cells(1,1) 09/20 09:58
soyoso: sheets("工作表1").cells(1,1) 09/20 09:59
soyoso: worksheets("工作表1").range("a1") 09/20 10:00
soyoso: sheets("工作表1").range("a1") 09/20 10:00
genow: 謝謝回覆~ 09/20 10:05
soyoso: 或是原文內Range(工作表1.Cells(1, 1))將range()部分取消 09/20 10:17
soyoso: 以工作表1.Cells(1, 1)方式 09/20 10:18