OilEconomist
Active Member
- Joined
- Dec 26, 2016
- Messages
- 439
- Office Version
- 2019
- Platform
- Windows
Thanks in advance for any suggestions for which feedback will be given.
Why is the following VBA Code actually bolding the cell and filling it in red when the cell is 1 or 3 for column 13? It is meant to say if j = 13 and if the value of the cell is not 1 or 3, then make it bold and fill it red, but it's doing the opposite.
Why is the following VBA Code actually bolding the cell and filling it in red when the cell is 1 or 3 for column 13? It is meant to say if j = 13 and if the value of the cell is not 1 or 3, then make it bold and fill it red, but it's doing the opposite.
Code:
For j = 1 to 41
If j = 20 Or j = 21 Or j = 22 Or j = 23 Or j = 31 _
Or j = 32 Or j = 34 Or j = 35 Or j = 36 Or j = 37 _
Or j = 39 Or j = 40 Then
'do nothing
ElseIf j = 13 Then
If Cells(i, j) <> 1 Or Cells(i, j) <> 3 Then
Cells(i, j).Font.Bold = True
Cells(i, j).Interior.ColorIndex = 3
End If
End If
Next j