Hmm... not quite what I had in mind, but thanks anyway.
A couple of days later and my mind is not so mushy; however, I still can't
see a solution. It just seems a bit clunky to do it the way I am, but if it
works and it's all I've got...
At least this got me thinking about ways to improve things around where I'm
doing this comparison. I'm trying to make sure that the user enters a valid
day of the month. The code (which I inherited) just looks to see if the value
is between 1 and 31 without regard to the month. This got me thinking about
ways to vary the range of acceptable values according to the month selected,
and I thought I had a solution - a variable for the uppermost acceptable
value, a Case statement to set it and a function to take in the value and do
the validation accordingly.
HOWEVER...
I'm now questioning the reasoning behind entering the month and day
separately in the first place, as the full date is required anyway. I suspect
the UserForm was designed this way because the previous developer wanted to
be able to insert the various parts of the date into the document separately
(e.g. "the 10th day of September, 2006") and didn't know how to parse the
date. I'm MUCH smarter than that! <g> I'll just use IsDate to validate the
value and then pick it apart afterwards.
So not a wasted effort since it did get me to re-examine the business rule
behind the functionality.
--
Cheers!
Gordon
Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.
macropod said:
Hi Gordon,
I suppose you could use:
If Abs(MyNumber -50.5) > 49.5 Then MsgBox "Don't be a dork!"
--
Cheers
macropod
[MVP - Microsoft Word]
"Gordon Bentley-Mix" <gordon(dot)bentleymix(at)gmail(dot)com> wrote in message
I'm sure there's an easy answer to this, but I'm having a senior moment. Is
there a better way to determine if a number is within a range of acceptable
values other than using something like this?
If myNumber < 1 Or myNumber > 100 Then
MsgBox "Don't be a dork!"
End If
Dunno why but I have this feeling that there is and I'm just missing it.
--
Cheers!
Gordon
Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.