View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Is Cell in Date Format

Can you not ignore format if you create the label using

Format(ActiveCell.Value, "dd mmm yyyy hh:mm:ss")

(or whatever format string you want)...


You could check the NumberFormat property for a particular format, e.g.:

If ActiveCell.NumberFormat Like "*yy*" Then
'likely a date - or use *m/d*, *d/m*, etc
Else
'Do something else
End If

In article .com,
wrote:

I have a userform that has a text label that reports the calendar date/
time in the format of the activecell. All works fine when the cell has
been formated to a date format but it gets reported back in various
odd ball forms when in General format, currency, %, fraction etc.

This occurs when the cell has not yet been formated to a date
It there a way I can used to to determine if the cell is in a date
format so I can change the label in these situations

The isdate function will tell if the cell is a date but I need to know
the cell format before data is entered.

TIA