How to check date format in display cell value

M

moonhk

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
 
J

JP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top