OK,
Here is what I am trying to do. The application is a parts/assembly spreadsheet. The part #'s all begin with "EL", such as EL039939, EL023348, etc. with a total of about 25 different parts. The same part #'s show up multiple times within the worksheet What I would like to do is have it color code each of the part#'s automatically, wherever and whenever they show up.
I have tried several things, but this is the closest I have come to get it to work. Please note the 'c.Value = 123' is only for testing. (This logic works, if the cell contents are 123)
Sub Colors()
For Each c In Worksheets("Main").Range("A:Z").Cells
If c.Value = 123 Then c.Interior.ColorIndex = 3
Next
End Sub
What I want it to look like is something like this:
Sub Colors()
For Each c In Worksheets("Main").Range("A:Z").Cells
If c.Value = EL00001 Then c.Interior.ColorIndex = 1
If c.Value = EL00002 Then c.Interior.ColorIndex = 2
If c.Value = EL00003 Then c.Interior.ColorIndex = 3
If c.Value = EL00004 Then c.Interior.ColorIndex = 4
If c.Value = EL00005 Then c.Interior.ColorIndex = 5
If c.Value = EL00006 Then c.Interior.ColorIndex = 6
If c.Value = EL00007 Then c.Interior.ColorIndex = 7
'(and so on until all part #'s are covered)
Next
End Sub
The problem seems to lie with the "c.Value = EL00001 part of the logic. This does not give any errors, it just doesn't do anything. The problem is the "EL", because if it is only numeric the logic (such as "c.Value = 1") it will work fine.
As far as the conditional formatting not working, I think I will try a reboot. It looks very straightforward, but it just isn't working for me.
Thanks
James
EDIT:
The conditional formating is still not working for me. I enter the info as shown, but get no effect from it.
Bookmarks