Active Worksheets Save as

John

New Member
Joined
Mar 12, 2002
Messages
24
Can any one help me with a macro to save only the active worksheets in a workbook using the save as function?
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Will this do?

<font face=Courier New><SPAN style="color:darkblue">Sub</SPAN> Copy_to_New_Workbook()

    ActiveSheet.Copy
    <SPAN style="color:darkblue">With</SPAN> ActiveWorkbook
        .SaveAs "C:\Documents and Settings\All Users\Desktop\Testing.xls"
        .<SPAN style="color:darkblue">Close</SPAN>
    <SPAN style="color:darkblue">End</SPAN> <SPAN style="color:darkblue">With</SPAN>

<SPAN style="color:darkblue">End</SPAN> <SPAN style="color:darkblue">Sub</SPAN></FONT>
 
Upvote 0
Thanks
I should have explained myself better.
I could have 1 or more worksheets I need to save. (there are other hidden worksheets I don't want included in the save as. I want to be able to select and save this group and ideally have the save as prompt pop up so I can give each save a new name. Is this possible?
 
Upvote 0
A little tweak to what Billy provided you might do it:
Code:
Sub Copy_to_New_Workbook()
    Dim ws As Worksheet
        For Each ws In ActiveWorkbook.Worksheets
            If ws.Visible = True Then
                ws.Activate
                    ActiveSheet.Copy
                        With ActiveWorkbook
                            .SaveAs "C:\Documents and Settings\All Users\Desktop\" & _
                                InputBox("Please enter the Save As Name...", "Worksheet Save As") & ".xls"
                            .Close
                        End With
                    End If
                Next ws
End Sub
Hope that helps,

Smitty
 
Upvote 0
Hi guys,

I would like to add another twist to this problem.

Imagine I have a workbook with 10 sheets.

I would like to copy just 3 of those sheets (indicating which one I would like to be copied referring to the sheet name) into a new workbook and save that new workbook with a name given by the user and in a path set by me.

How could I do that?
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

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