Worksheet copy problem

M

Matt

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
 
D

Don Guillett

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
 
D

Dave Peterson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top