Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Date Formatting

I have an interesting problem. I have column "E" on my spreadsheet that shows
all cells with a comment tick with the information, 'Text Date with a 2-digit
Year'. But when I try to programmatically correct this with a command like -

ActiveSheet.Columns("E").NumberFormat = "mm/dd/yyyy"

The format doesn't change my dates to reflect a four year digit. It will
only change if I format another cell that has no comment tick and actually
type in a date. Even if I copy and paste special-values into the other cell,
the format remain in the 2-digit year.

Anyone with a fix?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default Date Formatting

Langron

I doubt that the comment has anything to do with it - although what the
comment says probably does. I think you have text in the cells that looks
like a date, not an actual date. No matter how you change the number
format, the textdate won't change because it's text and not a number.

In the UI, after you change the format, hit F2 and enter to convert the text
to a number. In code, it would be

Range("E1").NumberFormat = "mm/dd/yyyy"
Range("E1").Value = Range("E1").Value

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

langron wrote:
I have an interesting problem. I have column "E" on my spreadsheet
that shows all cells with a comment tick with the information, 'Text
Date with a 2-digit Year'. But when I try to programmatically correct
this with a command like -

ActiveSheet.Columns("E").NumberFormat = "mm/dd/yyyy"

The format doesn't change my dates to reflect a four year digit. It
will only change if I format another cell that has no comment tick
and actually type in a date. Even if I copy and paste special-values
into the other cell, the format remain in the 2-digit year.

Anyone with a fix?



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
conditional formatting for cell date to equal today's date Sistereinstein Excel Worksheet Functions 2 September 10th 12 07:53 PM
Formatting changes date JacyErdelt Excel Discussion (Misc queries) 1 March 25th 09 10:21 PM
Date formatting Sandy Excel Worksheet Functions 2 August 1st 07 09:32 PM
date formatting Gracie Excel Discussion (Misc queries) 4 March 22nd 06 09:27 PM
Date Colum Date Formatting & Validation Mike[_81_] Excel Programming 1 June 7th 04 01:59 AM


All times are GMT +1. The time now is 11:46 PM.

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"