Hi Nick,
Try this code, changing cell, sheet, thisworkbook (activeworkbook) reference as appropriate.
HTH,
Mark
Sub test()
Dim sString As String
' You don't need to use a string variable as you could just use this as an argument to saveas
' Get full workbook path and name, but remove (.xls)
' Get contents of cell, but format as required
sString = Left(ThisWorkbook.FullName, Len(ThisWorkbook.FullName) - 4) & _
Format(ThisWorkbook.Worksheets("Sheet1").Range("a1 ").Value, "dd-mm-yyyy")
ThisWorkbook.SaveAs sString
End Sub
"NickMinUK " wrote:
Can someone help with code that changes the "save As" file name to a
combination of the original File Name + the contents of a cell, and
saves file in same folder as the original.
E.G. Original File Name= Timesheet
Cells B1= Location
Cell C1 = Date in format 3-5-2004
Cell A1 = concatenate(B1,C1)
Fle Name will therefore "Timesheet Location 3-5-2004"
The other problem is with the date. When concatenating, how do I format
the date to avoid it looking like "Location 38051"
Any help much appreciated
Nick
---
Message posted from http://www.ExcelForum.com/