Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Text Dates with 2 Digit Year

Data I copy from someone else's worksheets as part of a macro routine I've
developed include many cells containing text dates with 2 digit years. Excel
flags these cells, and allows me to fix the "errors"... Ijust select the
"Convert XX to 20XX" option and all is fine.

Does someone know I way I can perform this conversion from within a macro?

For now I've split my macro into two... I let the 1st macro stop with all
the affected cells selected at which time I manually do all the conversions
as above, and then start a 2nd macro... but that's definitely less than
desireable...

Thanks in advance !!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Text Dates with 2 Digit Year


Fogcity wrote:
Data I copy from someone else's worksheets as part of a macro routine I've
developed include many cells containing text dates with 2 digit years. Excel
flags these cells, and allows me to fix the "errors"... Ijust select the
"Convert XX to 20XX" option and all is fine.

Does someone know I way I can perform this conversion from within a macro?

For now I've split my macro into two... I let the 1st macro stop with all
the affected cells selected at which time I manually do all the conversions
as above, and then start a 2nd macro... but that's definitely less than
desireable...

Thanks in advance !!

what is the current format of the date mm/dd/yy or mmddyy or mm-dd-yy
or something else?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Text Dates with 2 Digit Year

It is dd-mmm-yy.

"stevebriz" wrote:


Fogcity wrote:
Data I copy from someone else's worksheets as part of a macro routine I've
developed include many cells containing text dates with 2 digit years. Excel
flags these cells, and allows me to fix the "errors"... Ijust select the
"Convert XX to 20XX" option and all is fine.

Does someone know I way I can perform this conversion from within a macro?

For now I've split my macro into two... I let the 1st macro stop with all
the affected cells selected at which time I manually do all the conversions
as above, and then start a 2nd macro... but that's definitely less than
desireable...

Thanks in advance !!

what is the current format of the date mm/dd/yy or mmddyy or mm-dd-yy
or something else?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Text Dates with 2 Digit Year

try this
i used B27 as my test cell

Dim strDate As String
Dim formdate As Date
formdate = Range("B27").Value
strDate = Format(formdate, "dd -mmm-yyyy")
MsgBox strDate

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
Automatically convert Text with 2-digit year juniper810 Excel Discussion (Misc queries) 3 April 24th 23 03:46 AM
Convert dates to 8 digit text HelenONeill Excel Discussion (Misc queries) 4 August 15th 07 01:28 PM
Addendum to 2 digit year to 4 digit year RealGomer Excel Discussion (Misc queries) 2 December 14th 06 05:48 PM
Format 2 digit year to 4 digit RealGomer Excel Discussion (Misc queries) 5 December 14th 06 01:45 PM
2 digit year in dates return 19xx not 20xx moranbo Excel Discussion (Misc queries) 1 September 7th 05 01:44 AM


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