View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Add one more condition

Well, you wouldn't use the intersect code - what you show now is not what I
understood you to explain.

For Each Cell In Range("D3:AJ19")

If Range("E25").Value = Range("G22") And Cell.Value "" and
Cells(Cell.Row,"A0") = "x" Then _
Cell.Value = Range("AO1")
End If
If Range("F25").Value = Range("H22") And Cell.Value "" and
Cells(Cell.Row,"AN") = "x" Then _
Cell.Value = Range("AN1")
End If

I doubt you want the construct you have presented, with nested If
statements, but if so, then just use the additional And statement from the
above.

You should be able to follow the pattern.

--
Regards,
Tom Ogilvy

"hotherps " wrote in message
...
Thanks Tom, I'm still having the problem though. Let me show you the
whole routine :

For Each Cell In Range("D3:AJ19")

If Range("E25").Value = Range("G22") And Cell.Value "" Then
Cell.Value = Range("AO1")
If Range("F25").Value = Range("H22") And Cell.Value "" Then
Cell.Value = Range("AN1")
If Range("G25").Value = Range("I22") And Cell.Value "" Then
Cell.Value = Range("AM1")
If Range("H25").Value = Range("J22") And Cell.Value "" Then
Cell.Value = Range("AL1")
If Range("I25").Value = Range("K22") And Cell.Value "" Then
Cell.Value = Range("AK1")
End If
End If
End If
End If
End If

Next
On Error GoTo 0

I'm not quite sure where, or how to use the "Intersect" code. I've
never used it before.

So for example on the first row where the cell AO1 is referenced I only
want the cell value to be AO1 if the cell AO3 = x
same thing for AO4 etc.

Thanks!!
Jim


---
Message posted from http://www.ExcelForum.com/