Macro Error
I keep receiving this error and I can't figure out what i've done wrong, any
help would be appreciated. Thanks Workbooks.Open Filename:="C:\Temp\Mgmt Team Stmt legacy.xls" Windows("Mgmt Team Stmt legacy.xls").Activate Sheets("Cover Sht").Select Sheets("Cover Sht").Copy Befo=Workbooks("Book1").Sheets(1) All I'm trying to do is copy a worksheet from a workbook, to another workbook. The last line is the line that continues to error out. |
Macro Error
I'd try including the .xls extension:
Sheets("Cover Sht").Copy Befo=Workbooks("Book1.xls").Sheets(1) Or maybe... dim wks as worksheet set wks = Workbooks.Open(Filename:="C:\Temp\Mgmt Team Stmt legacy.xls") _ .worksheets("cover sht") wks.copy _ Befo=Workbooks("Book1.xls").Sheets(1) 'maybe??? wks.parent.close savechanges:=false Vick wrote: I keep receiving this error and I can't figure out what i've done wrong, any help would be appreciated. Thanks Workbooks.Open Filename:="C:\Temp\Mgmt Team Stmt legacy.xls" Windows("Mgmt Team Stmt legacy.xls").Activate Sheets("Cover Sht").Select Sheets("Cover Sht").Copy Befo=Workbooks("Book1").Sheets(1) All I'm trying to do is copy a worksheet from a workbook, to another workbook. The last line is the line that continues to error out. -- Dave Peterson |
Macro Error
hi
your last line of code doesn't make sense. Before is a keyword used when adding a sheet. is that what your are trying to do? add a sheet to book 1. you need to activate book 1 or add book 1 first. post back with more info on what your are doing. regards FSt1 "Vick" wrote: I keep receiving this error and I can't figure out what i've done wrong, any help would be appreciated. Thanks Workbooks.Open Filename:="C:\Temp\Mgmt Team Stmt legacy.xls" Windows("Mgmt Team Stmt legacy.xls").Activate Sheets("Cover Sht").Select Sheets("Cover Sht").Copy Befo=Workbooks("Book1").Sheets(1) All I'm trying to do is copy a worksheet from a workbook, to another workbook. The last line is the line that continues to error out. |
All times are GMT +1. The time now is 06:58 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com