Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Arland Smith   on Feb 10 In MS Office Category.

  
Question Answered By: Eshe Chalthoum    on Feb 10

You question is so deceptively simple... yet confusing.

Who are you asking?
Are you wanting to prompt the user, or are you trying to determine
if a specific cell  is formatted  as a date?

If you're asking the user, then use something like:
Result = msgbox ("Is this cell formatted as a date?", vbyesno)
if (result = vbyes) then...

If you're trying to check the formatting of the cell,
are you concerned about the actual cell format (regardless of content)
or are you really trying to determine if the contents of the cell
is a valid date?

if you're checking the actuall format of the cell:
Try recording a macro that changes the formatting of a cell to several
valid date  formats.
you can then modify the macro to test any cell to determine if the
formatting matches one of the date formats
if selection.numberformat = "yyyy-mm-dd;@" _
or selection.numberformat = "dd/mm/yy;@" then
end if

if you're wanting to test the cell contents, try using:
if (isdate(selection.value)) then///

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Is this cell formatted as a date? Or get search suggestion and latest updates.


Tagged: