Hep with syntax on logic statement in vb

I am having a problem with getting the syntax correct on the below statement:
If Range("A2").Value = "New" And Range("C2") > 0 And Range("C8") > 0 And (IsEmpty(WS.Range("T6")) Or IsEmpty(WS.Range("W6"))) Then

What I need to test is if the value of A2 of current worksheet is equal to new and the value of C2 of the current worksheet is greater than zero and the value of C8 of the current worksheet is greater than zero, if T6 or  W6 is empty.  I have tried serveral different ways of placing the open and close parentheses with no success.

What am I doing wrong?
ilrosebud26Asked:
Who is Participating?
 
zorvek (Kevin Jones)Connect With a Mentor ConsultantCommented:
If Range("A2").Value = "New" And Range("C2") > 0 And Range("C8") > 0 And (IsEmpty(WS.Range("T6") Or IsEmpty(WS.Range("W6"))) Then

Kevin
0
 
EDDYKTCommented:
New is case senitive

ie

If ucase(Range("A2").Value) = "NEW" And Range("C2") > 0 And Range("C8") > 0 And (IsEmpty(WS.Range("T6")) Or IsEmpty(WS.Range("W6"))) Then
0
 
ilrosebud26Author Commented:
Kevin-
    I get a syntax error with the statement provided.

Rosemary
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
ilrosebud26Author Commented:
Kevin-
     I figured out what the syntx problem is but now I am getting a type mismatch error.  Can you help with that?

Rosemary
0
 
ilrosebud26Author Commented:
Can the problem be that cells C2 and C8 are text not numeric?
0
 
zorvek (Kevin Jones)ConsultantCommented:
Let's first make sure everything is correctly qualified:

If Range("A2").Value = "New" And WS.Range("C2").Value > 0 And WS.Range("C8").Value > 0 And (IsEmpty(WS.Range("T6") Or IsEmpty(WS.Range("W6"))) Then

Kevin
0
 
ilrosebud26Author Commented:
Kevin--
Sorry, same error message.
Rosemary

P.S.  If I take the OR logic out of the statement and execute them one at a time there is no error.
0
 
ilrosebud26Author Commented:
Kevin-
    I have it all figured out.  As always, thanks for your help.

Rosemary
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.