View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default General vs Date format question

First, remember a date is a positive number. So when you do ISDARE() it is
checking for a valid number that can be any date after Jan 1, 1900 which
equals 1.

You really want to check the numberformat property like this

Set MyCell = Range("A1")
Dateformat = MyCell.NumberFormat
If InStr(Dateformat, "/") = 0 Then 'check if the number format contains a
slash
'enter your code here
End If

"Brad" wrote:

Using 2007 (but need compatibility with 2003)

I want the "look" at what was entered - if the date contains "slashes" leave
it alone - if not, add the slashes. My main concern is to know what is the
"format" in data entered (regardless on how the cell is formatted) - I can
add the slashes as needed.