> In my macro I use the following line and it is working (vac is string
> variable)
>
> If Cells(i, "A").Value = vac And Cells(i, "b") = "EQ" Then
>
> My macro needs another "OR" condition also, for that i am using
>
> If Cells(i, "A").Value = vac And Cells(i, "b") = "EQ" or
> "BE" Then
>
> but it results in type mismatch error. How to combine "and" and "or"
> conditions?
You have to do each logical test separately in VB(A) and using parentheses
is always a good idea (sometimes your logic won't work correctly without
them, but including them always clarifies the logic). Try this statement
instead...
If Cells(i, "A").Value = vac And (Cells(i, "b") = "EQ" or Cells(i, "b") =
"BE") Then
Rick
|