using AND and OR as an if then condition

  • Thread starter Thread starter Frank Brown
  • Start date Start date
F

Frank Brown

Hi,
I am trying to create an if then statment that uses as its condition.

IF active.cell.value = (A or B) and Activecell(offset(0,3).value = C
then execute.

I am having problems with (A or B).

I could use some help with the context of the statement. A,B, and C
are all different ComboBox values. This is part of a look up routine
that sets down through one sheet and then copies values to another
sheet.

Thanks in advance,
Frank
 
Frank,

Try this

With ActiveCell
If (.Value = A OR .Value = B) AND .Offset(0,3).Value = C Then
'...
End If
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Frank said:
Hi,
I am trying to create an if then statment that uses as its condition.

IF active.cell.value = (A or B) and Activecell(offset(0,3).value = C
then execute.

Correct syntax would be:

If (ActiveCell.Value = A Or Activecell.Value = B) And _
ActiveCell.Offset(0,3).Value = C Then
' Code if condition is true
End If

Regards,
 
Back
Top