Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Filename based on Cell contents


Cell C2 contains a date in this format: 7/23/2006

How can I convert that date and place it in this file path
automatically, I put the result I need in bold?

='C:\Documents and Settings\PC\My Documents\Green
Books\[GB_*072306*-Q6150.xls]DailyWS'!$D$5

Thank you,
Em


--
Emma317
------------------------------------------------------------------------
Emma317's Profile: http://www.excelforum.com/member.php...o&userid=36598
View this thread: http://www.excelforum.com/showthread...hreadid=563417

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Filename based on Cell contents

I'd format the date and add it into the file path, something like this:

Dim strDate as String, strPath as String

strDate = Format(Range("C1").Value, "MMddyy")
strPath = "'C:\Documents and Settings\PC\My Documents\Green
Books\[GB_*" & strDate & "*-Q6150.xls]DailyWS'!$D$5"

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Filename based on Cell contents


Thanks for the reply, but I'm not sure how to put that in my worksheet.
I don't know much more than just typing into the cells. Does this go
somewhere else? Do I have to create a file that will run this?

Sorry, but I'm new at this.

Thanks,
Emily


--
Emma317
------------------------------------------------------------------------
Emma317's Profile: http://www.excelforum.com/member.php...o&userid=36598
View this thread: http://www.excelforum.com/showthread...hreadid=563417

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Filename based on Cell contents

Ah! I apologize for the delay inresponding and for misunderstanding
what you were trying to do. I thought you were programming this behind
the scenes in VBA. If you want to do that in a cell on a worksheet,
using your example type the following formula into cell D2 (or wherever
you want to result to end up):

="'C:\Documents and Settings\PC\My Documents\Green Books\[GB_*" &
IF(LEN(MONTH(C1))=1,"0" & MONTH(C1),MONTH(C1)) & IF(LEN(DAY(C1))=1,"0"
& DAY(C1),DAY(C1)) & RIGHT(YEAR(C1),2) & "*-Q6150.xls]DailyWS'!$D$5"

Thanks,
Cory

Emma317 wrote:
Cell C2 contains a date in this format: 7/23/2006

How can I convert that date and place it in this file path
automatically, I put the result I need in bold?

='C:\Documents and Settings\PC\My Documents\Green
Books\[GB_*072306*-Q6150.xls]DailyWS'!$D$5

Thank you,
Em


--
Emma317
------------------------------------------------------------------------
Emma317's Profile: http://www.excelforum.com/member.php...o&userid=36598
View this thread: http://www.excelforum.com/showthread...hreadid=563417


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
Create filename based on cell contents JR Hester Excel Worksheet Functions 7 April 4th 07 11:34 PM
Macro to Save As with filename based on cell contents. [email protected] Excel Programming 4 June 22nd 06 11:02 AM
How can I insert the contents of a cell as a filename? Tim Richards[_3_] Excel Programming 2 February 21st 05 07:45 PM
Create filename based on cell contents Rudy W Excel Programming 2 December 3rd 04 03:23 AM
cell contents as filename Jeff R Excel Programming 1 August 26th 04 03:02 PM


All times are GMT +1. The time now is 09:54 AM.

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

About Us

"It's about Microsoft Excel"