Copying sheet to its own wb

  • Thread starter Thread starter Rhonda Johnson
  • Start date Start date
R

Rhonda Johnson

i need to copy sheet(5) to its own workbook and then save
that wb as "file_" & worksheets(3).range("g10").text
& ".xls", is this possible

thanks so much
 
Hi Rhonda,

Of course it is <vbg>.

Worksheets(5).Copy
Set oWb = ActiveWorkbook
owb.saveas filename:= "file_" & worksheets(3).range("g10").text &
".xls",


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
set bk = Activeworkbook
bk.worksheets(5).Copy

ActiveWorkbook.Saves "file_" & _
bk.worksheets(3).range("g10").text & ".xls"
 
Just a heads up,

Since the single sheet workbook (the copy of worksheets(5)) is the
activeworkbook, then Worksheets(3).Range... would refer to that workbook and
raise an error.

worksheets(3) needs to be qualified with the source workbook reference
 
Thanks Tom, missed that.

Bob

Tom Ogilvy said:
Just a heads up,

Since the single sheet workbook (the copy of worksheets(5)) is the
activeworkbook, then Worksheets(3).Range... would refer to that workbook and
raise an error.

worksheets(3) needs to be qualified with the source workbook reference
 

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

Back
Top