and + or

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
 
R

RadarEye

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
 
S

Stefi

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:
 
P

pls123

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:
 
Top