View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default help in VB for cell values changing in rows & columns w/result in

Sub AABBCC()
Dim rngF as Range, rngG as Range, rngD as Range
Dim rngD1 as Range, rngE as Range
Dim i as Long
For i = 2 To 202
Set rngF = Cells(i, "F")
Set rngG = Cells(i, "G")
Set rngD = Cells(i, "D")
Set rngD1 = Cells(i + 1, "D")
Set rngE = Cells(i + 1, "E")

If rngF 10 And rngG = rngD Then
res = "COMPLIANT"
ElseIf (rngF 10 And rngG < rngD) Then
res = "NONCOMPLIANT"
ElseIf (rngF < 10 And rngE = rngD1) Then
res = "COMPLIANT"
ElseIf (rngF < 10 And rngE < rngD1) Then
res = "NONCOMPLIANT"
Else
res = "anomaly"
End If
MsgBox "row: " & i & " result: " & res
Next

End Sub


--
Regards,
Tom Ogilvy

"Gale" wrote in message
...
The value in F is either less than 10 or greater than 10. Value is a
variable date in columns D, G & E.

If Col F result is 10 or more, and G2 is = D2, THEN COMPLIANT
If Col F result is 10 or more, and G2 is < D2, THEN NONCOMPLIANT
If Col F result is <10, and E3 is = D3, THEN COMPLIANT
If Col F result is <10, and E3 is < D3, THEN NONCOMPLIANT