Once again, I messed up with my question/request. I am really sorry
that I am having such a dificult time being clear about things. The
user will fill in the dates any way they want. If the cell contains
only a date, then I can set the cell format to yyyy-mm-dd and then
whatever the user types in, Excel will re-format it and then when I
extract the date I will get the yyyy-mm-dd format. But, when other
text is in the cell with the date, the formatting doesn't work so then
I have to deal with a variety of date formats. Also, then I have to
re-format the dates through vba after validating the cell contents.
Maybe, I could first look for something that looks sort of like a date
and then pop up a message telling the user to format it like yyyy-mm-dd
if it does not match that format, then do the validation.
Ron Rosenfeld wrote:
On 26 Sep 2006 09:37:37 -0700, wrote:
I figured out how to get the code to work that sets a reference. No
matter which code I run the line: strDate = REMid(c.Text, PatternDate)
strDate comes up empty, when I hover over it I get empty double quotes,
even when the only content of the cell is 1/1/2006
That is in accord with your specification. You wrote:
"If there is a date, it must be formatted like: yyyy-mm-dd and it must
be the first thing."
1/1/2006 is m/d/yyyy (or d/m/yyyy) but it clearly is NOT yyyy-mm-dd
--ron