![]() |
Sheet Referencing?
I'm hoping someone can help me........... I want to be able to
open a workbook trigger a macro that will copy a spcific sheet titled "Tasks" in its entirity and open it in another workbook overwriting any "Tasks" sheet that was there. Thank you to anyone who helps. |
Sheet Referencing?
Here is some untested pseudo code that should "show the way"
Private Sub Workbook_Open() Dim bk as Workbook, sh as Worksheet On Error Resume Next set bk = Workbooks("Destination.xls") set sh = bk.Worksheets("Tasks") On Error goto 0 if bk is nothing then msgbox "Destination.xls is not open" exit sub end if if not sh is nothing then Application.DisplayAlerts = False sh.Delete application.DisplayAlerts = true end if thisworkbook.Worksheets("Tasks").copy _ After:=bk.worksheets(bk.worksheets.count) end Sub this would go in the Thisworkbook module of the source workbook. Adjust to fit your environment, functionality, requirements. -- Regards, Tom Ogilvy "Benz" wrote: I'm hoping someone can help me........... I want to be able to open a workbook trigger a macro that will copy a spcific sheet titled "Tasks" in its entirity and open it in another workbook overwriting any "Tasks" sheet that was there. Thank you to anyone who helps. |
Sheet Referencing?
Thank You Tom.
"Tom Ogilvy" wrote: Here is some untested pseudo code that should "show the way" Private Sub Workbook_Open() Dim bk as Workbook, sh as Worksheet On Error Resume Next set bk = Workbooks("Destination.xls") set sh = bk.Worksheets("Tasks") On Error goto 0 if bk is nothing then msgbox "Destination.xls is not open" exit sub end if if not sh is nothing then Application.DisplayAlerts = False sh.Delete application.DisplayAlerts = true end if thisworkbook.Worksheets("Tasks").copy _ After:=bk.worksheets(bk.worksheets.count) end Sub this would go in the Thisworkbook module of the source workbook. Adjust to fit your environment, functionality, requirements. -- Regards, Tom Ogilvy "Benz" wrote: I'm hoping someone can help me........... I want to be able to open a workbook trigger a macro that will copy a spcific sheet titled "Tasks" in its entirity and open it in another workbook overwriting any "Tasks" sheet that was there. Thank you to anyone who helps. |
All times are GMT +1. The time now is 08:43 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com