Essentially this macro, is simply comparing cells in the same row, and based of the number two cells away from my selection it will provide a specific output. It then loops to the next cell and compares the cells in that row.
My issue, is that no matter what ever cell returns "Still not working", for the life of me I can't figure out what it keeps doing that.
My issue, is that no matter what ever cell returns "Still not working", for the life of me I can't figure out what it keeps doing that.
Code:
Sub Corrections()
Dim Cell As Range
For Each Cell In Selection
If Cell.Offset(0, -23) = Cell.Offset(0, -27) _
And Cell.Offset(0, -8) = Cell.Offset(0, -12) _
And Cell.Offset(0, -7) = Cell.Offset(0, -11) Then
Cell.Value = "C"
ElseIf Cell.Offset(0, -2).Value = 21 _
And Cell.Offset(0, -23) <> Cell.Offset(0, -27) _
Or Cell.Offset(0, -22) <> Cell.Offset(0, -26) _
Or Cell.Offset(0, -21) <> Cell.Offset(0, -25) Then
Cell.Value = "Still Not Working"
ElseIf Cell.Offset(0, -2).Value = 31 _
And Cell.Offset(0, -23) <> Cell.Offset(0, -27) _
Or Cell.Offset(0, -22) <> Cell.Offset(0, -26) _
Or Cell.Offset(0, -21) <> Cell.Offset(0, -25) Then
Cell.Value = "RME"
ElseIf Cell.Offset(0, -2).Value = 36 _
And Cell.Offset(0, -23) <> Cell.Offset(0, -27) _
Or Cell.Offset(0, -22) <> Cell.Offset(0, -26) _
Or Cell.Offset(0, -21) <> Cell.Offset(0, -25) Then
Cell.Value = "NA"
ElseIf Cell.Offset(0, -2).Value = 32 _
And Cell.Offset(0, -23) <> Cell.Offset(0, -27) _
Or Cell.Offset(0, -22) <> Cell.Offset(0, -26) _
Or Cell.Offset(0, -21) <> Cell.Offset(0, -25) Then
Cell.Value = "RME"
ElseIf Cell.Offset(0, -2).Value = 22 _
And Cell.Offset(0, -23) <> Cell.Offset(0, -27) _
Or Cell.Offset(0, -22) <> Cell.Offset(0, -26) _
Or Cell.Offset(0, -21) <> Cell.Offset(0, -25) Then
Cell.Value = "UNDV"
ElseIf Cell.Offset(0, -2).Value = 37 _
And Cell.Offset(0, -32) <> Cell.Offset(0, -27) _
Or Cell.Offset(0, -22) <> Cell.Offset(0, -26) _
Or Cell.Offset(0, -21) <> Cell.Offset(0, -25) Then
Cell.Value = "NA"
ElseIf Cell.Offset(0, -23) <> Cell.Offset(0, -27) _
And Cell.Offset(0, -22) = Cell.Offset(0, -26) _
And Cell.Offset(0, -21) = Cell.Offset(0, -25) Then
Cell.Value = "ID"
ElseIf Cell.Offset(0, -23) = Cell.Offset(0, -27) _
And Cell.Offset(0, -22) <> Cell.Offset(0, -26) _
And Cell.Offset(0, -21) = Cell.Offset(0, -25) Then
Cell.Value = "ID"
ElseIf Cell.Offset(0, -23) = Cell.Offset(0, -27) _
And Cell.Offset(0, -22) = Cell.Offset(0, -26) _
And Cell.Offset(0, -21) <> Cell.Offset(0, -25) Then
Cell.Value = "ID"
End If
Next Cell
End Sub
Last edited by a moderator: