Hi All,
I'm trying to write some code to loop through some data and to do something if one condition (two things must be true) is satisfied or a separate condition is. The code is working so far as in if the first condition is meet it performs the action but it not working for the other condition. Here is the code
The code is not recognising the text 'Journey End Event' in the cell. I've tried this code also but it not working either.
Its a simple problem but cant seem to figure it out. Any ideas?
John
I'm trying to write some code to loop through some data and to do something if one condition (two things must be true) is satisfied or a separate condition is. The code is working so far as in if the first condition is meet it performs the action but it not working for the other condition. Here is the code
Code:
i = 1
Range("j2").Select
'do loop to check 3 things, conditions are 1 and 2, or 3:
'1. acceleration is negative
'2. speed is zero
'3. The text 'Journey End Event' is found in the cell
Do
If (ActiveCell.Offset(0, -3) < 0 And ActiveCell.Offset(0, -6) = 0) Or ActiveCell.Offset(0, -5) = "Journey End Event" Then
ActiveCell.Value = i
i = i + 1
End If
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell.Offset(0, -1))
Code:
ActiveCell.Offset(0, -5).text = "Journey End Event"
Its a simple problem but cant seem to figure it out. Any ideas?
John