Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default Concatenate & Date

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?

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Concatenate & Date

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
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,574
Default Concatenate & Date

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
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
How do I create a schedule from a list of dates ? Gavin Morris Charts and Charting in Excel 2 October 28th 10 04:08 PM
How to return a value between date ranges Mary-Lou Excel Worksheet Functions 7 May 26th 06 10:00 PM
count between start date and end date flow23 Excel Discussion (Misc queries) 5 May 10th 06 01:22 PM
NETWORKDAYS - Multiple Date Selection Annabelle Excel Discussion (Misc queries) 3 October 4th 05 07:04 PM
Date CONCATENATE AYPCN Excel Worksheet Functions 2 March 10th 05 04:42 PM


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