INI ADALAH LANJUTAN DARI BAGIAN PERTAMA
Copy Paste dalam satu sheet yang sama
Imports Excel = Microsoft.Office.Interop.Excel
Public Class Form1
Dim xlApp As New Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
Dim xlSourceRange, xlDestRange As Excel.Range
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
xlWorkBook = xlApp.Workbooks.Open("C:\vb dan excel\percobaan.xlsx")
xlApp.Visible = True
xlWorkSheet = xlWorkBook.Sheets("Sheet1")
'~~> sumber yg mau di copy
xlSourceRange = xlWorkSheet.Range("A1:B10")
'~~> tujuan atau mau dipaste
xlDestRange = xlWorkSheet.Range("D1")
'~~> Copy paste range
xlSourceRange.Copy(xlDestRange)
End Sub
End Class