Excel VBA : Range.Copy
Excel VBA 複製方法 在本節中,我們將研究複製方法。 VBA中復制數據的三種方式: Range.Copy 函數 assignment 運算符(i.e. equals sign) Range.CopyFromRecordset 函數(僅限 ADO) 在接下來的小節中,我們將依次介紹這些內容。 我們將使用這些 Excel VBA 複製方法和不同的過濾方法。
Range.Copy
我們可以使用 Range 的 Copy 方法來複製數據。
Sub SimpleCopy()
' Get the worksheet
Dim shRead As Worksheet
Set shRead = ThisWorkbook.Worksheets("Transactions")
' Copy the data from A1:D1 to H1:K1
shRead.Range("A1:D1").Copy Destination:=shRead.Range("H1")
' Using Destination is optional
shRead.Range("A1:D1").Copy shRead.Range("H1")
End Sub