B
b_yousif
I recorded a macro where i select a range for copy then open a spcifi
file go to sheet2 and paste.
i copy this code to a button macro, but when i tried to run and clic
the button it a run-time error 1004: "Method openof object Workbook
failed "
the code is as follow under sheet1 (code):
Sub CommandButton1_Click()
Range("D2:H51").Select
Selection.copy
Workbooks.Open Filename:="Z:\My documents\myfile.xls"
Sheets("Sheet2").Select
Range("A10").Activate
ActiveSheet.Paste
End Su
file go to sheet2 and paste.
i copy this code to a button macro, but when i tried to run and clic
the button it a run-time error 1004: "Method openof object Workbook
failed "
the code is as follow under sheet1 (code):
Sub CommandButton1_Click()
Range("D2:H51").Select
Selection.copy
Workbooks.Open Filename:="Z:\My documents\myfile.xls"
Sheets("Sheet2").Select
Range("A10").Activate
ActiveSheet.Paste
End Su