PASTIKAN Workbooks.Open("E:\EXTERNAL IMPOR\target.xlsx")
SIMPAN DI DRIVE E
NAMA FOLDER : EXTERNAL IMPOR
NAMA FILE YANG AKAN DIIMPOT DATANYA : target.xlsx
PASTEKAN KODE BERIKUT PADA SEBUAH MODUL :
Sub impor_DATA1()
On Error Resume Next
Dim myData As Workbook
Dim myRekap As Workbook
Set myRekap = ActiveWorkbook
Set myData = Workbooks.Open("E:\EXTERNAL IMPOR\target.xlsx")
Worksheets("sheet1").Range("a4:H50").Select
Set salin = Worksheets("sheet1").Range("a4:H50")
Set simpan = myRekap.Sheets("sheet1").Range("a4:H50")
salin.Copy
simpan.PasteSpecial Paste:=xlPasteAll
myData.Save
myData.Close
End Sub
Sub impor_DATA222()
On Error Resume Next
Dim myData As Workbook
Dim myRekap As Workbook
Set myRekap = ActiveWorkbook
Set myData = Workbooks.Open("E:\EXTERNAL IMPOR\target.xlsx")
Worksheets("sheet2").Range("a4:H50").Select
Set salin = Worksheets("sheet2").Range("a4:H50")
Set simpan = myRekap.Sheets("sheet2").Range("a4:H50")
salin.Copy
simpan.PasteSpecial Paste:=xlPasteAll
myData.Save
myData.Close
End Sub
No comments:
Post a Comment