![]() |
creat a macro to save a copy with different file name
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. |
creat a macro to save a copy with different file name
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 "yrndtn" wrote in message ups.com: 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. |
creat a macro to save a copy with different file name
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 -- Kevin Backmann "yrndtn" wrote: 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. |
All times are GMT +1. The time now is 04:38 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com