save activesheet as a new workbook

kwagner1

Active Member
Joined
Jun 10, 2003
Messages
445
I have a workbook that has multiple worksheets. As my code processes the workbook i move from sheet to sheet. Is there a way to save JUST the activesheet to a new workbook (i.e. "save as") - or do i have to have the code open a new workbook, copy, paste the worksheet to the new workbook and then close it. (and yes, i'm looking for code to do it all...)

Thanks!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi,
You can record a macro for this...
you will get something like
Code:
    Sheets("sheet1").Select
    Sheets("sheet1").Copy
make it
Code:
ActiveSheet.Copy
kind regards,
Erik
 
Upvote 0
Erik, your code looks like it will select another sheet in the book and then copy it. I want to select another sheet in the book and then save that sheet to another file. Here's my code so far:
Code:
Sheets(2).Select
ActiveSheet.SaveAs ThisWorkbook.Path & "\" & "testken"

The problem is the new workbook called "testken.xls" has all the sheets from the original workbook. i simply want the 1 sheet saved to the new "testken.xls" file.
 
Upvote 0
If you omit the Before/After argument when you copy a sheet then a new workbook is created, with only that sheet.
Code:
ActiveSheet.Copy

Set wbNew = ActiveWorkbook

wbNew.SaveAs ThisWorkbook.Path & "\testken"
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,603
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top