Greetings .....
was able to overcome the error ...needed to do x = instead x.
Please see the update ....also moving with same is there a way to check the previous value for cell c.
i.e in if condition c is checked for LOA now if it is true and >1 then prior ACT period gets added.
Overall goal is to insert data into sheets from database which may have multiple statuses for same hence think need to update the code me trying the same but inputs would be much appreciated
Sub test()
Dim x As Integer
Range("b2").Select
'Cells(65536, 2).End(xlUp).Select
x = ActiveCell.Row
For i = 2 To x
If Range("c" & i).Value = "LOA" And Format(Range("b" & i).Value - Range("a" & i).Value, "m") > 6 Then
MsgBox Format(Range("b" & i).Value - Range("a" & i).Value, "m")
End If
Next i
End Sub
Bookmarks