Saving with name and date macro

  • Thread starter Thread starter Bobby
  • Start date Start date
B

Bobby

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?
 
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!
 
Thank You for the replies Guys, your help, once again has got me what i
needed.
 

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