Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save spreadsheet using cell values as filename Tony Excel Discussion (Misc queries) 1 March 23rd 10 02:59 PM
How do i save an excel spreadsheet from a captured cell? luke-sushi Excel Discussion (Misc queries) 1 May 27th 09 03:17 PM
SAVE OR SAVE-AS with a file name derived from a cell on the spreadsheet... KLZA Excel Programming 0 July 31st 07 03:52 PM
how to save a range of cell values vhrao Excel Programming 3 July 18th 06 02:30 AM
macro to save a values of a cell in a new sheet as a new row dpt Excel Programming 8 August 8th 05 07:41 AM


All times are GMT +1. The time now is 03:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"