PC Review


Reply
Thread Tools Rate Thread

Concatenate & Date

 
 
General Specific
Guest
Posts: n/a
 
      25th Sep 2006
I am trying to create a macro that saves a spreadsheet to a name based
on data in a few cells.

For example, if I have Date and ProjectName in two cells, I want the
macro to save the worksheet as DateProjectName.csv.

I tried to Concatenate these values into one cell. From there I was
goint to use the following the Save As that value using:

Public Sub SaveAsA1()
ThisFile = Range("A1").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
End Sub


Concatenate changes the date to a string returning 38936ProjectName.
What is going on here?

Anyone have a better way to do this?

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      25th Sep 2006
ThisFile = format(range("a2").value, "yyyymmdd") & Range("A1").Value

Remember that Windows doesn't like /'s in file names.

General Specific wrote:
>
> I am trying to create a macro that saves a spreadsheet to a name based
> on data in a few cells.
>
> For example, if I have Date and ProjectName in two cells, I want the
> macro to save the worksheet as DateProjectName.csv.
>
> I tried to Concatenate these values into one cell. From there I was
> goint to use the following the Save As that value using:
>
> Public Sub SaveAsA1()
> ThisFile = Range("A1").Value
> ActiveWorkbook.SaveAs Filename:=ThisFile
> End Sub
>
> Concatenate changes the date to a string returning 38936ProjectName.
> What is going on here?
>
> Anyone have a better way to do this?


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?RGF2ZSBG?=
Guest
Posts: n/a
 
      25th Sep 2006
Well, if you were using CONCATENATE in the workbook, your function should
look like this: =CONCATENATE(DATE(2006,9,1),"ProjectName") -->
9/1/2006ProjectName

I imagine it's similar in VBA.

Dave
--
Brevity is the soul of wit.


"General Specific" wrote:

> I am trying to create a macro that saves a spreadsheet to a name based
> on data in a few cells.
>
> For example, if I have Date and ProjectName in two cells, I want the
> macro to save the worksheet as DateProjectName.csv.
>
> I tried to Concatenate these values into one cell. From there I was
> goint to use the following the Save As that value using:
>
> Public Sub SaveAsA1()
> ThisFile = Range("A1").Value
> ActiveWorkbook.SaveAs Filename:=ThisFile
> End Sub
>
>
> Concatenate changes the date to a string returning 38936ProjectName.
> What is going on here?
>
> Anyone have a better way to do this?
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenate including a date so that the date appears as a date Zembu Microsoft Excel Worksheet Functions 2 6th Jan 2010 06:09 PM
Concatenate a date and name rd251 Microsoft Excel Worksheet Functions 2 11th Mar 2009 06:55 AM
Concatenate Date =?Utf-8?B?TGVzbGllIFcu?= Microsoft Access Queries 5 17th Oct 2007 03:49 PM
I know how to concatenate ,can one de-concatenate to split date? =?Utf-8?B?UVVJQ0sgQk9PS1MgUFJPQkxFTS0=?= Microsoft Excel New Users 1 26th Jul 2005 05:07 PM
Date CONCATENATE =?Utf-8?B?QVlQQ04=?= Microsoft Excel Worksheet Functions 2 10th Mar 2005 04:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:22 AM.