View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default how to use 2 conditions in if

If cell = 1122 Then
If cell.Value = cell.Offset(0,1).Value Then
....
End If

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Sergei D" wrote in message
...
This is a follow up on my last question. I am sorry I did not formulate my
question right. In my example I have only one range ("a8:a30"). I need it,
after it matches the cell = 1122 in column A, to go to column B and meet
another condition. Basically, I need it to match column A with column B

and
then I want it to evaluate IF.
Dim cell As Range
Dim str As String
For Each cell In Range("a8:a30")
If cell = 1122 Then

cell.Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
ElseIf Not IsEmpty(cell.Value) Then
cell.Select
With Selection.Interior
.ColorIndex = 5
.Pattern = xlSolid
End With
Else: Range("a33").Select
ActiveCell.FormulaR1C1 = "end of transactions"
End If
Next cell
End Sub

--
Sergei D