hello
i have two files it should data from file "dd" but it gives me error runtime 438
Code
Sub CopyFromClosedWorkbook()
' Defines variables
Dim wb1 As Workbook, wb2 As Workbook
' Disable screen updating to reduce screen flicker
Application.ScreenUpdating = False
' Define which workbook is which
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("C:\Users\alhagag\Desktop\dd.xlsx")
' Copy range A2:d70 from the Data sheet of wb2
wb2.Sheets("sheet1").Range("A2:d70").Copy
' Paste the copied data to range b2 of the Data sheet in wb1
wb1.Sheets("sheet1").Activate
ActiveSheet.Range("b2").Paste
' Close wb2
wb2.Close
' Re-enable screen updating
Application.ScreenUpdating = True
End Sub
Display More