Save File in different way

K

K

Hi all,  I have code below which save the current worksheet in
folder "Record" with the name "Rec"


Private Sub CommandButton1_Click()
Me.Select
Me.Copy
ActiveWorkbook.SaveAs Filename:="C:\Documents\Record\Rec.xlsm",
FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
ActiveWindow.Close
End Sub

I want to give name "Rec" to all my files in same folder but I want
macro to put 1 , 2 , 3… etc at the end of every file name. How can I
change above macro that it should first check the folder "Record" if
there is any file with the name "Rec" and if there is then it should
put 1 at the end of the file and save it.
 

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

Top