Conditional testing

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
 
S

SeanC UK

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top