Conditional testing

  • Thread starter Thread starter John
  • Start date Start date
J

John

I have three cells, Cell1 is formatted as a text string, Cell2 a number and
Cell3 a date. If each contains a valid entry I want to do a block of code.
If any is empty, or if Cell2 or Cell3 contain text, I want to skip the code.
How do I write the If statement?

I appreciate your help, -John
 
Hi John,

you can try something like:

If (IsEmpty(rng1) Or IsEmpty(rng2) Or _
IsEmpty(rng3)) Or (Not IsDate(rng2)) Or _
(Not IsNumeric(rng3)) Then
'BAD
Else
'OK
End If

Where rng1, 2 and 3 refer to the cells Text, Date and Number respectively.

Hope this helps,

Sean.
 
Back
Top