I am attempting to create output for one column in my table by basing it off of the values in two other columns.
I've tried working with the variables and think I have gotten the loop to work. The issues I keep running into are "Mismatch" and "Global"
Private Sub formatcolumnF()
Dim eqa As Range, eqt As Range
Set eqa = ActiveSheet.Range("D2", Range("D2").End(xlDown))
Set eqt = ActiveSheet.Range("C2", Range("C2").End(xlDown))
Dim result As String, Cell As Range
For Each Cell In eqa
If Cell >= eqt.Value + 0.025 Then
result = "OVER"
ElseIf Cell <= eqt.Value - 0.025 Then
result = "UNDER"
ElseIf Cell <= eqt.Value + 0.025 Or Cell >= eqt.Value - 0.025 Then
result = "ON TARGET"
Else
result = ""
End If
Next Cell
Range("F2", Range("F2").End(xlDown)).Value = result
End Sub
I expect the output in column F to be one of the string results. When I run it for a specific row in the table the code works but when I try to run it for the whole column it does not.