Excel Variable Save Name problem

L

Lippa73

I have written a program for work that is basically a daily cash u
spreadsheet, however I would like to save each days report as a backup


Ideally I would like to save the worksheet as that days date by us
of a command button/macro to reduce the chance of user erro( ie savin
under wrong name) The date is on the worksheet, but I can't figure ou
a way to use a range as a save name.

I would really appreciate some help with this problem. Cheer
 
R

Ron de Bruin

Hi Lippa73

One way to save a copy in C:\ with a date/time stamp

Sub test()
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
With ThisWorkbook
.SaveCopyAs "C:\Copy of " & ThisWorkbook.Name _
& " " & strdate & ".xls"
End With
End Sub
 
B

Bob Phillips

ActiveWorkbook.SaveCopyAs "C:\MyDir\ & _ Format(Range("A1"),"yyyy/mm/dd")
& _ - Cash Up.xls"-- HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
B

Bob Phillips

Got screwed up a bit

ActiveWorkbook.SaveCopyAs "C:\MyDir\ & _
Format(Range("A1"),"yyyy/mm/dd") & _
"- Cash Up.xls"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Bob Phillips said:
ActiveWorkbook.SaveCopyAs "C:\MyDir\ & _ Format(Range("A1"),"yyyy/mm/dd")
& _ - Cash Up.xls"-- HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
B

Bob Phillips

Also shouldn't put / in there

ActiveWorkbook.SaveCopyAs "C:\MyDir\ & _
Format(Range("A1"),"yyyy-mm-dd") & _
"- Cash Up.xls"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Bob Phillips said:
Got screwed up a bit

ActiveWorkbook.SaveCopyAs "C:\MyDir\ & _
Format(Range("A1"),"yyyy/mm/dd") & _
"- Cash Up.xls"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top