![]() |
Worksheet copy problem
I would like to copy a worksheet to a new workbook using
direct syntax...unfortunately the activeworkbook does not change to the new workbook when I do so...I would prefer not to use the Worksheets("Sheet1") approach and instead use wks (such as set wks = wkb.worksheets(1)) Here is my Set wkb = thisworkbook set wks = wkb.worksheets(1) wks.copy msgbox ActiveWorkbook.name How can I make the ActiveWorkbook name change to the newly created workbook Thanks Matt |
Worksheet copy problem
I don't understand. When you do this you copy the sheet to a new wb. You can then add the line activeworkbook.name="whateveryouwanttonameit" or use a saveas -- Don Guillett Microsoft MVP Excel SalesAid Software "Matt" wrote in message ... I would like to copy a worksheet to a new workbook using direct syntax...unfortunately the activeworkbook does not change to the new workbook when I do so...I would prefer not to use the Worksheets("Sheet1") approach and instead use wks (such as set wks = wkb.worksheets(1)) Here is my Set wkb = thisworkbook set wks = wkb.worksheets(1) wks.copy msgbox ActiveWorkbook.name How can I make the ActiveWorkbook name change to the newly created workbook Thanks Matt |
Worksheet copy problem
Is there something special about where the code is? Is it in a General module?
Is there anything special about wkb.worksheets(1)? Does msgbox activesheet.parent.name work? In most cases, the newly created sheet will be the activesheet and the activeworkbook will be that new workbook. Matt wrote: I would like to copy a worksheet to a new workbook using direct syntax...unfortunately the activeworkbook does not change to the new workbook when I do so...I would prefer not to use the Worksheets("Sheet1") approach and instead use wks (such as set wks = wkb.worksheets(1)) Here is my Set wkb = thisworkbook set wks = wkb.worksheets(1) wks.copy msgbox ActiveWorkbook.name How can I make the ActiveWorkbook name change to the newly created workbook Thanks Matt -- Dave Peterson |
All times are GMT +1. The time now is 03:26 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com