![]() |
Saving with a filename already in a cell
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 |
Saving with a filename already in a cell
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 -- crispb ----------------------------------------------------------------------- crispbd's Profile: http://www.excelforum.com/member.php...fo&userid=1088 View this thread: http://www.excelforum.com/showthread.php?threadid=27458 |
All times are GMT +1. The time now is 02:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com