ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to check date format in display cell value (https://www.excelbanter.com/excel-programming/400718-how-check-date-format-display-cell-value.html)

moonhk

How to check date format in display cell value
 
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


JP[_3_]

How to check date format in display cell value
 
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 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





All times are GMT +1. The time now is 08:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com