and + or

  • Thread starter Thread starter pls123
  • Start date Start date
P

pls123

hi all i have a doubt about the syntax of this to be correct..
i want b5+b9 or b5+l9 do i have to use parenthesis around or ??
tyvm

If Range("B5") = 1 And Range ("B9") = True Or Range("B5") = 1 And
("L9") = True Then
Range("A1") = 'You are lucky!
End If
 
Hi

As soon as you are using a combination of And and Or it is better to
use ()

Try

If (Range("B5") = 1And Range("B9") = True) Or _
(Range("B5") =1 And Range("L9") = True) Then
Range("A1") = 'You are lucky!
End If

HTH,

RadarEye
 
Yes, you have to!
If (Range("B5") = 1 And Range ("B9") = True) Or (Range("B5") = 1 And
("L9") = True) Then

Regards,
Stefi

„pls123†ezt írta:
 
ty!!

Stefi said:
Yes, you have to!
If (Range("B5") = 1 And Range ("B9") = True) Or (Range("B5") = 1 And
("L9") = True) Then

Regards,
Stefi

„pls123†ezt írta:
 

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

Similar Threads

Change_Event target either of two cells 20
copy range using 4
Hide Rows 3
Array to Multiple Arrays 3
Worksheet events problem 2
Help with code please 4
Prevent clicking on a cell 7
Need another eye on this Sub() 8

Back
Top