ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   IF and or (https://www.excelbanter.com/excel-programming/317824-if.html)

tango

IF and or
 
Dear All,
i wonder if vba supports AND or OR?
i try to use the AND or OR but error

IF sum = 100 then OR
sum = 200 then
..............
ELSE
..............
END IF

thanks

Chip Pearson

IF and or
 
Try something like

If sum = 100 Or sum = 200 Then
' do something
Else
' do something else
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"tango" wrote in message
om...
Dear All,
i wonder if vba supports AND or OR?
i try to use the AND or OR but error

IF sum = 100 then OR
sum = 200 then
.............
ELSE
.............
END IF

thanks




Dave Peterson[_5_]

IF and or
 
if sum = 100 _
or sum = 200 _
then
'do onething
else
'do another
end if

or maybe:

if sum = 100 then
'do one thing
elseif sum = 200 then
'do a 2nd thing
else
'do a 3rd thing
end if



tango wrote:

Dear All,
i wonder if vba supports AND or OR?
i try to use the AND or OR but error

IF sum = 100 then OR
sum = 200 then
.............
ELSE
.............
END IF

thanks


--

Dave Peterson


All times are GMT +1. The time now is 11:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com