#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 173
Default File name Save

Dear Expert,
A1 has a text "Performance2009_"
A2 has a formula =Today()
A3 is day(A2) = 11 (in this case)
A3 is month(A2) = 4 (in this case)
A3 is year(A2) = 2009 (in this case)
How can I use concatenate function to make up to "Performance2009_11042009"
please ?
Second question is ....
Say B1 can successfully make up to "Performace2009_11042009" ....
How can I use marco (VB) to save the file name same as cell B1 (ie
Performace2009_11042009) ?
Thanks in advance


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default File name Save

If you're going to use the current date, you don't need to use cells on the
worksheet.

Dim myFileName as string
with worksheets("SomeSheetnamehere")
myfilename = .range("a1").value & format(date, "mmddyyyy") & ".xls"
.parent.saveas filename:="C:\somepathhere\" & myfilename, _
fileformat:=xlworkbooknormal
end with

You could concatentate cells, too:
myfilename = .range("a1").value & _
format(.range("a2").value, "mmddyyyy") & ".xls"

or

myfilename = .range("a1").value & format(.range("a3").value, "00") _
& format(.range("a4").value, "00") _
& format(.range("a5").value, "0000") & ".xls"

(I figured you meant a3:A5.)

ps.

I'd use the date in yyyymmdd order. So I can sort the names in windows explorer
in chronological order more easily.

pps. All untested, uncompile. Watch for typos.

Elton Law wrote:

Dear Expert,
A1 has a text "Performance2009_"
A2 has a formula =Today()
A3 is day(A2) = 11 (in this case)
A3 is month(A2) = 4 (in this case)
A3 is year(A2) = 2009 (in this case)
How can I use concatenate function to make up to "Performance2009_11042009"
please ?
Second question is ....
Say B1 can successfully make up to "Performace2009_11042009" ....
How can I use marco (VB) to save the file name same as cell B1 (ie
Performace2009_11042009) ?
Thanks in advance


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 515
Default File name Save

In A6 enter the following formula
=A1&A3&.A4&A5

Press <Alt<F11
Click on Insert, Module
Enter the following code
Sub FileSaver()
Dim vName as variant
vName = Range("A6")
Activeworkbook.saveas (vName)
End Sub

to run the macro, either link to a button, or simply press <Alt<F8, select
FileSaver and click on Run.

--
HTH

Kassie

Replace xxx with hotmail


"Elton Law" wrote:

Dear Expert,
A1 has a text "Performance2009_"
A2 has a formula =Today()
A3 is day(A2) = 11 (in this case)
A3 is month(A2) = 4 (in this case)
A3 is year(A2) = 2009 (in this case)
How can I use concatenate function to make up to "Performance2009_11042009"
please ?
Second question is ....
Say B1 can successfully make up to "Performace2009_11042009" ....
How can I use marco (VB) to save the file name same as cell B1 (ie
Performace2009_11042009) ?
Thanks in advance


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 173
Default File name Save

Hi,
I have corrected A3 to A5.

A1 has a text "Performance2009_"
A2 has a formula =Today()
A3 is day(A2) = 11 (in this case)
A4 is month(A2) = 4 (in this case)
A5 is year(A2) = 2009 (in this case)

I used Concatenate or =A1&A2&A3&A4&A5
But it comes up with Performance2009_1142009 rather than
Performance2009_11042009
There is a 0 missing in month field.
Then How to ?
Save part is "work" for Kassie
Thaks


"Dave Peterson" wrote:

If you're going to use the current date, you don't need to use cells on the
worksheet.

Dim myFileName as string
with worksheets("SomeSheetnamehere")
myfilename = .range("a1").value & format(date, "mmddyyyy") & ".xls"
.parent.saveas filename:="C:\somepathhere\" & myfilename, _
fileformat:=xlworkbooknormal
end with

You could concatentate cells, too:
myfilename = .range("a1").value & _
format(.range("a2").value, "mmddyyyy") & ".xls"

or

myfilename = .range("a1").value & format(.range("a3").value, "00") _
& format(.range("a4").value, "00") _
& format(.range("a5").value, "0000") & ".xls"

(I figured you meant a3:A5.)

ps.

I'd use the date in yyyymmdd order. So I can sort the names in windows explorer
in chronological order more easily.

pps. All untested, uncompile. Watch for typos.

Elton Law wrote:

Dear Expert,
A1 has a text "Performance2009_"
A2 has a formula =Today()
A3 is day(A2) = 11 (in this case)
A4 is month(A2) = 4 (in this case)
A5 is year(A2) = 2009 (in this case)
How can I use concatenate function to make up to "Performance2009_11042009"
please ?
Second question is ....
Say B1 can successfully make up to "Performace2009_11042009" ....
How can I use marco (VB) to save the file name same as cell B1 (ie
Performace2009_11042009) ?
Thanks in advance


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default File name Save

Why bother with the extra cells. Just use VBA's Date function.

=a1&text(a2,"00")&text(a3,"00")&text(a4,"0000")

But if you look at those earlier suggestions, there are easier ways.

I don't understand this portion:
Then How to ?
Save part is "work" for Kassie



Elton Law wrote:

Hi,
I have corrected A3 to A5.

A1 has a text "Performance2009_"
A2 has a formula =Today()
A3 is day(A2) = 11 (in this case)
A4 is month(A2) = 4 (in this case)
A5 is year(A2) = 2009 (in this case)

I used Concatenate or =A1&A2&A3&A4&A5
But it comes up with Performance2009_1142009 rather than
Performance2009_11042009
There is a 0 missing in month field.
Then How to ?
Save part is "work" for Kassie
Thaks

"Dave Peterson" wrote:

If you're going to use the current date, you don't need to use cells on the
worksheet.

Dim myFileName as string
with worksheets("SomeSheetnamehere")
myfilename = .range("a1").value & format(date, "mmddyyyy") & ".xls"
.parent.saveas filename:="C:\somepathhere\" & myfilename, _
fileformat:=xlworkbooknormal
end with

You could concatentate cells, too:
myfilename = .range("a1").value & _
format(.range("a2").value, "mmddyyyy") & ".xls"

or

myfilename = .range("a1").value & format(.range("a3").value, "00") _
& format(.range("a4").value, "00") _
& format(.range("a5").value, "0000") & ".xls"

(I figured you meant a3:A5.)

ps.

I'd use the date in yyyymmdd order. So I can sort the names in windows explorer
in chronological order more easily.

pps. All untested, uncompile. Watch for typos.

Elton Law wrote:

Dear Expert,
A1 has a text "Performance2009_"
A2 has a formula =Today()
A3 is day(A2) = 11 (in this case)
A4 is month(A2) = 4 (in this case)
A5 is year(A2) = 2009 (in this case)
How can I use concatenate function to make up to "Performance2009_11042009"
please ?
Second question is ....
Say B1 can successfully make up to "Performace2009_11042009" ....
How can I use marco (VB) to save the file name same as cell B1 (ie
Performace2009_11042009) ?
Thanks in advance


--

Dave Peterson


--

Dave Peterson
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 and SAVE AS options disappeared from the drop down FILE menu [email protected] Excel Discussion (Misc queries) 2 July 12th 07 09:14 AM
when i save xls file, debug script is running and canno't save fil Imtiaz Excel Discussion (Misc queries) 1 July 16th 05 03:47 PM
Excell2003 (SP-1) File > Save and File > Save As.. grayed out Joe Murphy Excel Discussion (Misc queries) 0 March 9th 05 10:00 PM
Save & Save As features in file menu of Excel Blue Excel Discussion (Misc queries) 9 December 27th 04 08:49 PM
Save Excel file - prompts to save - no Volitile functions used POWER CERTS Excel Worksheet Functions 2 November 1st 04 09:27 PM


All times are GMT +1. The time now is 04:05 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"