I've tried each of these IF statements in all the orders that seem logical but I think there is something wrong with the IF statement highlighted below.
Essentially what I am telling my ELSEIF to do:
If TRUE already exists in the cell, then leave it be, keep it true and move on.
Instead it bypasses it, and changes it to "Within Limits" or "Outside Limits".
I've changed it around where the highlighted text is the first IF statement, but that doesn't work either.
I thought IF statements found the first TRUE statement and then bypassed everything else?
Essentially what I am telling my ELSEIF to do:
If TRUE already exists in the cell, then leave it be, keep it true and move on.
Instead it bypasses it, and changes it to "Within Limits" or "Outside Limits".
I've changed it around where the highlighted text is the first IF statement, but that doesn't work either.
I thought IF statements found the first TRUE statement and then bypassed everything else?
Code:
For i = 2 To lrow
Set mycell = myworksheet.Range("AK" & i) 'Contains Unit of Measure
Set mycell2 = myworksheet.Range("AD" & i) 'Contains UN/ID#
Set mycell3 = myworksheet.Range("AM" & i) 'Contains static part #
If mycell.Value = "L" And mycell2.Value = "UN3363" Then 'if UOM is L and UN/ID# is 3363 then
mycell.Offset(, 2).Formula = "=IFERROR(IF(AL" & i & "=AJ" & i & ",TRUE,FALSE),""Error"")" '
[B][COLOR=#0000ff] ElseIf mycell3 = "TRUE" Then[/COLOR][/B]
[B][COLOR=#0000ff] mycell3 = "TRUE"[/COLOR][/B]
Else
mycell.Offset(, 2).Formula = "=IFERROR(IF(ABS(AJ" & i & " - AL" & i & ") <= AL" & i & "*0.1, ""Within Limit"", ""Outside Limit""),""Error"")"
End If
Next
Last edited: