Save Worksheets as Tab Name plus Cell Value and Date

SuperFerret

Well-known Member
Joined
Mar 2, 2009
Messages
515
Hello,

I want to be able to save worksheets in my workbook as individual workbooks, using the tab name, a cell value and the date (DD MMM Format)

Basically, I have a workbook which we are using to upload to a new system, and we have devised a workbook where only one worksheet has to be completed and the other worksheets are filled in ready.

The problem is I have to have each of these sheets as individual workbooks to load into the system which is very time consuming.

I can't work out how to split the workbook into the 5 sheets, and rename them (should be saved as TABNAME_cellA2value_DD_MMM.xls)

Any help would be appreciated!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Thanks Yahya, but that doesn't really do what I need.

All the Sheets have a different name
e.g. Activate, Update, Profile, Cost, RRP
All the Sheets A2 cells have the same value
e.g. C1

I need to split out each sheet and save it for example like this:
S:\CREATES\Activate_C1_21_JUL.xls
 
Upvote 0
try this
Code:
Sub Test()
Dim ws As Worksheet, wb As Workbook
Application.DisplayAlerts = False
For Each ws In Sheets
    Workbooks.Add
    Set wb = ActiveWorkbook
    With wb
        .SaveAs Filename:="S:\CREATES\" & ws.Name & "_" & ws.Range("A2").Value & "_" & Format(Date, "DD MMM") & ".xls"
        ws.Copy Before:=.Sheets(1)
        .Save
        .Close
    End With
Next ws
Application.DisplayAlerts = True
End Sub
 
Upvote 0
Sorry yes all Sheets except one called DATA, is there a way to ignore the sheet called DATA?

The macro does exactly what I need so far thanks for all your help Yahya
 
Upvote 0
try this to ignore sheet DATA
Code:
Sub Test()
Dim ws As Worksheet, wb As Workbook
Application.DisplayAlerts = False
For Each ws In Sheets
    If ws.Name <> "DATA" Then
        Workbooks.Add
        Set wb = ActiveWorkbook
        With wb
            .SaveAs Filename:="S:\CREATES\" & ws.Name & "_" & ws.Range("A2").Value & "_" & Format(Date, "DD MMM") & ".xls"
            ws.Copy Before:=.Sheets(1)
            .Save
            .Close
        End With
    End If
Next ws
Application.DisplayAlerts = True
End Sub
 
Upvote 0
Thanks again Yahya! :-)

Ok... slight problem

Now I'm being told that the system will not accept formulas... so is there a way to amend this so it copies the others sheets out as values only?
 
Upvote 0
try this please
Code:
Sub Test()
Dim ws As Worksheet, wb As Workbook
Application.DisplayAlerts = False
For Each ws In Sheets
    If ws.Name <> "DATA" Then
        Workbooks.Add
        Set wb = ActiveWorkbook
        With wb
            .SaveAs Filename:="S:\CREATES\" & ws.Name & "_" & ws.Range("A2").Value & "_" & Format(Date, "DD MMM") & ".xls"
            ws.Copy Before:=.Sheets(1)
            .Sheets(1).Cells.Copy
            .Sheets(1).Cells.PasteSpecial xlValues
            .Save
            .Close
        End With
    End If
Next ws
Application.DisplayAlerts = True
End Sub
 
Upvote 0
Thanks again, I'm having a problem though when I open the file to check it. It's giving me an error message:

The file you are trying to open, 'Activate_C1_21_Jul', is in a different format that specified by the file extenstion. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?

I select Yes and it opens fine and looks ok, but it won't let me upload it to the system either...saying the data is invalid :-(

When I try to save it manually it wants to save as .xlsx??
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,592
Messages
6,179,786
Members
452,942
Latest member
VijayNewtoExcel

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