Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save Spreadsheet As 2 or 3 cell values
I would like to automatically name the the file with some static text and
thevalues from 2 or 3 cells. For example: I am creating a expense account and I would like the the name to be: XYZ_Expenses_"Date"_"Amount" Whe XYZ_Expenses is Static test, Date is located in cell J3, Amount is located in cell J30 I am not very familiar with using or building macros, so any information on how to build and run the macro and would be greatly appreciated. Thanks in advance. Win XP and Excel 2007 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save Spreadsheet As 2 or 3 cell values
On Oct 28, 9:56*am, Vic49 wrote:
I would like to automatically name the the file with some static text and thevalues from 2 or 3 cells. For example: I am creating a expense account and I would like the the name to be: XYZ_Expenses_"Date"_"Amount" Whe XYZ_Expenses is Static test, Date is located in cell J3, Amount is located in cell J30 I am not very familiar with using or building macros, so any information on how to build and run the macro and would be greatly appreciated. Thanks in advance. Win XP and Excel 2007 I'd recommend naming the cells J3 and J30 as Date and Amount respectively (Formulas-Define Name). Then try something like the following: Sub Rename() Dim wbkToBeSaved as Workbook Dim sOldName as String Dim sDate as String Dim sAmount as String Dim sNewName as String Const sPREFIX = "XYZ_Expenses_" ' Get the workbook you want to rename sOldName = "" ' Whatever the old name is... Set wbkToBeSaved = Workbooks(sOldName) ' Build new name sDate = wbkToBeSaved.Names("Date").RefersToRange.Text sAmount = wbkToBeSaved.Names("Amount").RefersToRange.Text sNewName = sPREFIX & sDate & "_" & sAmount wbkToBeSaved.SaveAs sNewName End Sub HTH Geoff |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Save spreadsheet using cell values as filename | Excel Discussion (Misc queries) | |||
How do i save an excel spreadsheet from a captured cell? | Excel Discussion (Misc queries) | |||
SAVE OR SAVE-AS with a file name derived from a cell on the spreadsheet... | Excel Programming | |||
how to save a range of cell values | Excel Programming | |||
macro to save a values of a cell in a new sheet as a new row | Excel Programming |