Saving excel tabs in to seperate workbooks

MOORED

New Member
Joined
Sep 25, 2017
Messages
14
Hi i am new in here and also very new to VBA so I am doing a little self training and course but could do with some help quickly.

I am looking for some code to save only the visible tabs in a workbook separately but I would like to name the file as the text in a cell

e.g.

I have two tabs invoice and credit in a work book
I would like to run the macro to save each to a folder and name it with the contents of cell A1Hope the above makes sense I would appreciate any help

D :)
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi & welcome to the board
Is this what you're after
Code:
Sub SaveShts()

    Dim Ws As Worksheet

Application.ScreenUpdating = False

    For Each Ws In Worksheets
        If Ws.Visible Then
            Ws.Copy
            ActiveWorkbook.SaveAS "[COLOR=#ff0000]C:\Users\Fluff\Desktop\test\[/COLOR]" & Range("A1").Text, 51
            ActiveWorkbook.Close
        End If
    Next Ws

End Sub
Change the part in red to match your file path
 
Upvote 0
Hi

many thanks for your time and your reply,

I am on a steep learning curve :)


I run the code and it saves the first worksheet with text "A1"
then it tries to save the second sheet but says the file already exists (it is using A1 on the first worksheet again rather than the A1 from the second worksheet

again any help would be appreciated
 
Upvote 0
OK, try this
Code:
Sub SaveShts()

    Dim Ws As Worksheet

Application.ScreenUpdating = False

    For Each Ws In Worksheets
        If Ws.Visible Then
            Ws.Copy
            ActiveWorkbook.SaveAS "C:\Users\Fluff\Desktop\test\" & Ws.Range("A1").Text, 51
            ActiveWorkbook.Close
        End If
    Next Ws

End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,973
Messages
6,122,534
Members
449,088
Latest member
RandomExceller01

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