Saving with a filename already in a cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to create a way to automatically save the workbook as a particular
filename with the addition of the month/date already entered in a cell. When
the original blank is filled out and my "update" macro is run, the file will
be saved as "Monthly Report" followed by the addition of the information in
cell E4 (the date and year). ('Monthly Report Oct 2004') How do I write
this in my macro?

Thanks
 
Copy and paste this macro into a module in your workbook.
This macro demands that the value in cells(4,5) - Cell E4, contains
Date Value, not just a text representation of the date. (something lik
11/01/2004')

Sub SaveMonthlyReport

Dim MyFileName As String
MyFileName = "Monthly Report " & MonthName(Month(Cells(4, 5).Value)
True)
& " " & Year(Cells(4, 5).Value)
ActiveWorkbook.SaveAs Filename:= _
MyFileName & ".xls"

End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top