PC Review


Reply
Thread Tools Rate Thread

How to check date format in display cell value

 
 
moonhk
Guest
Posts: n/a
 
      7th Nov 2007
Hi All

In the Cell A1 input mm/dd/yyyy, then change the format to mm/dd/yy .
How to check the display format is len(A1) = 8 or 10 by VBA ?

My Coding as below incorrect

'~~ Check format
If Len(loSheet.Cells(rwIndex, colIndex).Value) >
kFormatSize(colIndex) Then
xerr = xerr + 1
loSheet.Cells(rwIndex,
colIndex).Interior.ColorIndex = colorErr

End If


moonhk
GMT+8

 
Reply With Quote
 
 
 
 
JP
Guest
Posts: n/a
 
      7th Nov 2007
It's hard to tell what you are trying to do, but when I enter
"12/31/2007" in A1, format as mm/dd/yy, then put =LEN(A1) in another
cell, the answer is 5.

Excel stores dates as sequential numbers starting from Jan, 1 1900, so
for example 39448is 1/1/2008.



HTH,
JP


On Nov 6, 8:46 pm, moonhk <moon_ils...@yahoo.com.hk> wrote:
> Hi All
>
> In the Cell A1 input mm/dd/yyyy, then change the format to mm/dd/yy .
> How to check the display format is len(A1) = 8 or 10 by VBA ?
>
> My Coding as below incorrect
>
> '~~ Check format
> If Len(loSheet.Cells(rwIndex, colIndex).Value) >
> kFormatSize(colIndex) Then
> xerr = xerr + 1
> loSheet.Cells(rwIndex,
> colIndex).Interior.ColorIndex = colorErr
>
> End If
>
> moonhk
> GMT+8



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change the display data format cell already contain data as date Harun Microsoft Excel Misc 2 1st Mar 2010 11:48 AM
Format DataGridView cell display format in a Window form Ben Microsoft C# .NET 1 20th Dec 2007 01:40 PM
VBA Date Format Cell Check Kim Microsoft Excel Programming 2 19th Dec 2007 07:20 PM
Check if Conditional Format is True or False / Check cell Color =?Utf-8?B?S2V2aW4gTWNDYXJ0bmV5?= Microsoft Excel Worksheet Functions 5 29th Jun 2007 11:12 AM
Date displays as serial number. Cannot format to display as date =?Utf-8?B?U3VubnlH?= Microsoft Excel Crashes 1 7th Mar 2006 02:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:49 PM.