PDA

View Full Version : iteration loop



willemeulen
01-04-2010, 01:43 AM
I need a VBA Iteration loop.

Event will be value of cell (selection setting)

If Cell E5 = 4.......
If cell F5 < G5 add 0.001 to cell A5
If cell F5 = G5 end sub

Any help is welcome.

w

xld
01-04-2010, 02:04 AM
Not sure what ... Event will be value of cell (selection setting) ... means, but here goes



For Each cell In Range(Range("A5"), Range("A5").End(xlDown))

If cell.Value = 4 Then

If cell.Offset(0, 1).Value < .cell.Offset(0, 2).Value Then

cell.Offset(0, -4).Value = cell.Offset(0, -4).Value + 0.001

ElseIf cell.Offset(0, 1).Value = .cell.Offset(0, 2).Value Then

End Sub
End If
End If
Next cell