Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Excel VB - copying formatted dates programatically

I am assuiming you have an actual date and not a string to be converted.

dim strDate as string
strdate = format(range("A1").value, "yymmdd")
--
HTH...

Jim Thomlinson


"Glenn" wrote:

I have a date field with "yymmdd" format. I want to programatically convert
that to text that looks identical to the formatted date for use in
dimensioned variables/strings.
e.g. - date 6/10/2008 formatted looks like "080610". I want to use a/the
text string "080610" for various other uses. Can anyone help?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default Excel VB - copying formatted dates programatically

Many thanks - I found a longer way involving month, day, and year functions,
but this is clean. Yes, I have an actual date. thanks gain.....

"Jim Thomlinson" wrote:

I am assuiming you have an actual date and not a string to be converted.

dim strDate as string
strdate = format(range("A1").value, "yymmdd")
--
HTH...

Jim Thomlinson


"Glenn" wrote:

I have a date field with "yymmdd" format. I want to programatically convert
that to text that looks identical to the formatted date for use in
dimensioned variables/strings.
e.g. - date 6/10/2008 formatted looks like "080610". I want to use a/the
text string "080610" for various other uses. Can anyone help?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Excel VB - copying formatted dates programatically

If you format the date in the approproately in the spreadsheet the you could
just use

dim strDate as string
strdate = range("A1").text
--
HTH...

Jim Thomlinson


"Glenn" wrote:

Many thanks - I found a longer way involving month, day, and year functions,
but this is clean. Yes, I have an actual date. thanks gain.....

"Jim Thomlinson" wrote:

I am assuiming you have an actual date and not a string to be converted.

dim strDate as string
strdate = format(range("A1").value, "yymmdd")
--
HTH...

Jim Thomlinson


"Glenn" wrote:

I have a date field with "yymmdd" format. I want to programatically convert
that to text that looks identical to the formatted date for use in
dimensioned variables/strings.
e.g. - date 6/10/2008 formatted looks like "080610". I want to use a/the
text string "080610" for various other uses. Can anyone help?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default Excel VB - copying formatted dates programatically

What I love about VB is there are often many ways to skin the cat. Thanks
again for your insight and options.

"Jim Thomlinson" wrote:

If you format the date in the approproately in the spreadsheet the you could
just use

dim strDate as string
strdate = range("A1").text
--
HTH...

Jim Thomlinson


"Glenn" wrote:

Many thanks - I found a longer way involving month, day, and year functions,
but this is clean. Yes, I have an actual date. thanks gain.....

"Jim Thomlinson" wrote:

I am assuiming you have an actual date and not a string to be converted.

dim strDate as string
strdate = format(range("A1").value, "yymmdd")
--
HTH...

Jim Thomlinson


"Glenn" wrote:

I have a date field with "yymmdd" format. I want to programatically convert
that to text that looks identical to the formatted date for use in
dimensioned variables/strings.
e.g. - date 6/10/2008 formatted looks like "080610". I want to use a/the
text string "080610" for various other uses. Can anyone help?

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
If a range of cells in Excel are formatted as dates ie. (mm/dd/yy) mfoley Excel Discussion (Misc queries) 3 January 20th 07 05:50 PM
copying part of a cell's contents (formatted as dd:hh:mm) Tom in Americus Excel Worksheet Functions 1 March 27th 06 12:07 AM
Programatically copy cells with dates Francis Brown Excel Programming 4 November 18th 05 08:37 PM
Dates in Excel - yyyymmdd, not formatted, how do I format this? colin Excel Discussion (Misc queries) 3 September 29th 05 06:45 PM
Copying Formats vs Formatting Programatically Adam Excel Programming 4 March 31st 05 09:29 PM


All times are GMT +1. The time now is 02:37 PM.

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"