This used to work fine in Excel 2003, but I've just noticed that using Excel 2007 it doesn't seem to be performing in the same way. I have a range of cells in a column, and this code loops through the range to test if the user has left it blank or put in some data that is deemed to be incorrect from the list contained within the IF statement below, and if it does meet the criteria then the cell is coloured yellow and it moves on the the next one. What it is now doing is finding that every cell meets the criteria and colouring it yellow. For example, I've just witnessed sCellCheck = "BENNI X" or "TINE MUNK" and the cell has been coloured. Anyone able to advise why it would do that? Thanks all.
Code:
For Each sCellCheck In sRange
If sCellCheck Like "" Or sCellCheck Like "*?*" Or LCase(sCellCheck) Like "x x" Or sCellCheck Like "- -" Or sCellCheck Like "-- --" Or sCellCheck Like "*--*" Or sCellCheck Like "- --" Or sCellCheck Like "- - -" Or sCellCheck Like "- - --" Or sCellCheck Like "-- -- --" Or sCellCheck Like "-- - --" Or sCellCheck Like "-- ---" Then
sCellCheck.Select
With Selection.Interior
.Color = 65535
End With
End If
Next