#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default and + or

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default and + or

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

On 22 sep, 13:31, pls123 wrote:
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default and + or

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:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default and + or

ty!!

"Stefi" wrote:

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:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"