Hi Orquidea,
It looks like you're trying to write a macro that will evaluate two conditions using the
if statement and the
and /
or operators. Here's an example of how you can do this:
- First, select the cell where you want to start the macro.
- Open the VBA editor by pressing Alt + F11.
- In the editor, create a new subroutine by clicking on "Insert" and then "Module".
- Type the following code:
Formula:
Sub EvaluateConditions()
Do Until ActiveCell.Offset(0, -13) = ""
If ActiveCell.Offset(0, -1) < "VOY" And (ActiveCell.Offset(0, -2) = "London" Or ActiveCell.Offset(0, -2) = "Cambridge") Then
ActiveCell.Offset(0, 1).Value = "GOOD"
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub
- Save the macro and close the editor.
- Go back to your Excel sheet and run the macro by pressing Alt + F8 and selecting "EvaluateConditions" from the list.
This macro will loop through all the cells in column C and evaluate the two conditions you specified: B is different than "VOY" and A is equal to "London" or "Cambridge". If both conditions are true, the macro will set the value of the cell in column C to "GOOD".