Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving with name and date macro
Hi i hope someone can help me.
I'm trying to set up a macro to save a work book with the name taken from cell B5 and the date in B6, but after saving i then i need it to stay on the original book and not on the newly saved one. Can anyone help please? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving with name and date macro
Without specifying a path this will save in My Documents: Code: -------------------- ActiveWorkbook.SaveCopyAs (ActiveSheet.Range("B5").Value & " - " & Format(ActiveSheet.Range("B6"), "dd - mmm - yy") & ".xls") -------------------- -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=35583 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving with name and date macro
Option Explicit
Sub Testme() Dim myFileName As String Dim myPath As String myPath = "C:\somefoldernamehere\" With ActiveWorkbook.Worksheets("sheet1") myFileName = .Range("b5").Value _ & "-" _ & Format(.Range("B6").Value, "yyyy-mm-dd") & ".xls" .Parent.SaveCopyAs Filename:=myFileName End With End Sub This doesn't have any validity checks at all! Bobby wrote: Hi i hope someone can help me. I'm trying to set up a macro to save a work book with the name taken from cell B5 and the date in B6, but after saving i then i need it to stay on the original book and not on the newly saved one. Can anyone help please? -- Dave Peterson |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving with name and date macro
Thank You for the replies Guys, your help, once again has got me what i
needed. "Dave Peterson" wrote: Option Explicit Sub Testme() Dim myFileName As String Dim myPath As String myPath = "C:\somefoldernamehere\" With ActiveWorkbook.Worksheets("sheet1") myFileName = .Range("b5").Value _ & "-" _ & Format(.Range("B6").Value, "yyyy-mm-dd") & ".xls" .Parent.SaveCopyAs Filename:=myFileName End With End Sub This doesn't have any validity checks at all! Bobby wrote: Hi i hope someone can help me. I'm trying to set up a macro to save a work book with the name taken from cell B5 and the date in B6, but after saving i then i need it to stay on the original book and not on the newly saved one. Can anyone help please? -- Dave Peterson |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving with name and date macro
Glad you got what you need, however Dave's is the one to go with really!Bobby;158440 Wrote: Thank You for the replies Guys, your help, once again has got me what i needed. "Dave Peterson" wrote: Option Explicit Sub Testme() Dim myFileName As String Dim myPath As String myPath = "C:\somefoldernamehere\" With ActiveWorkbook.Worksheets("sheet1") myFileName = .Range("b5").Value _ & "-" _ & Format(.Range("B6").Value, "yyyy-mm-dd") & ".xls" .Parent.SaveCopyAs Filename:=myFileName End With End Sub This doesn't have any validity checks at all! Bobby wrote: Hi i hope someone can help me. I'm trying to set up a macro to save a work book with the name taken from cell B5 and the date in B6, but after saving i then i need it to stay on the original book and not on the newly saved one. Can anyone help please? -- Dave Peterson -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=35583 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving Macro | Excel Discussion (Misc queries) | |||
Help with saving a Macro | Excel Worksheet Functions | |||
Saving a macro | New Users to Excel | |||
Saving with Macro | Excel Discussion (Misc queries) | |||
Saving without Macro | Excel Discussion (Misc queries) |