creat a macro to save a copy with different file name

Y

yrndtn

I need to creat a macro that save a copy of the file, and take the file
name from a cell at the worksheet. this cell is changing everytime i
need to save the file, therefor i will not have the same file name.
 
J

Jim May

One way:
Run Macro "Testme" and it will perform a
File, Save_As (to the current directory) creating
a File Name = to Cell J2.

Sub testme()
Application.Dialogs(xlDialogSaveAs).Show _
Worksheets("sheet1").Range("j2").Value & ".xls"
End Sub

HTH
Jim
 
K

Kevin B

I named cell A1 on Sheet1, NewFileName, using the INSERT/NAME/DEFINE command
off the menu.

This is the file save code:

Sub SaveMe()

Dim strName As String

strName = Range("NewFileName").Text

If Len(strName) = 0 Then
MsgBox "There isn't a file name in cell A1."
Else
ActiveWorkbook.SaveAs strName
End If

End Sub
 
Top