change date to value in VBA

zakasnak

Active Member
Joined
Sep 21, 2005
Messages
307
I have a macro that I run to pull sheets from a workbook into their own file. The file name is created based on value in certain cells. Currently, my code puts today's date at the end of the file name, but I would like for it to pull the date from cell C8. I'm having problems converting my code to make this happen.

Code:
Sub SaveWS_to_NewWBs()
Dim wb As Workbook
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
    ws.Copy
    Set wb = ActiveWorkbook
    wb.SaveAs ThisWorkbook.Path & "\" & ws.Range("A8").Value & " " & ws.Name & " " & ws.Range("X8").Value & " " & Format(Date, "yyyymmdd") & ".xls"
    wb.Close False
Next ws
End Sub


I would like for this part: & Format(Date, "yyyymmdd") to pull from C8. I would also like to use the format "yyyymmdd".

Help?
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,215,227
Messages
6,123,743
Members
449,116
Latest member
alexlomt

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