Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I create a schedule from a list of dates ? | Charts and Charting in Excel | |||
How to return a value between date ranges | Excel Worksheet Functions | |||
count between start date and end date | Excel Discussion (Misc queries) | |||
NETWORKDAYS - Multiple Date Selection | Excel Discussion (Misc queries) | |||
Date CONCATENATE | Excel Worksheet Functions |