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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
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
 

kwagner1

Active Member
Joined
Jun 10, 2003
Messages
445
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.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,303
Office Version
  1. 365
Platform
  1. Windows
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"
 

Forum statistics

Threads
1,141,011
Messages
5,703,726
Members
421,311
Latest member
tanujath

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
Top