# Select Case Problems

##### Board Regular
I thought this was an easy code to write, but apparently I'm wrong in a number of places. On one worksheet (Labelling) I'm reading a string and if it matched the case it outputs a colour in exactly the same cell pointer on another worksheet (Colour Chart).

Sub ColourChart1()
Dim irow As Integer, icol As Integer, System As String
For irow = 10 To 148
For icol = 2 To 255
System = Worksheets("Labelling").Cells(irow, icol)
Select Case System
Case "E" Or "e"
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(255, 0, 0)
Case "S" Or s
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(204, 255, 204)
Case "H" Or "h"
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(51, 153, 102)
Case "R" Or "r"
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(255, 204, 153)
Case "F" Or "f"
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(255, 255, 0)
Case "C" Or "c"
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(255, 153, 0)
Case "D" Or "d"
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(255, 0, 255)
Case Else
End Select
Next icol
Next irow

End Sub

### Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

#### VoG

##### Legend
Try

Code:
``````Sub ColourChart1()
Dim irow As Integer, icol As Integer, System As String
For irow = 10 To 148
For icol = 2 To 255
System = Worksheets("Labelling").Cells(irow, icol)
Select Case UCase(System)
Case "E"
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(255, 0, 0)
Case "S"
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(204, 255, 204)
Case "H"
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(51, 153, 102)
Case "R"
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(255, 204, 153)
Case "F"
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(255, 255, 0)
Case "C"
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(255, 153, 0)
Case "D"
Worksheets("Colour Chart").Cells(irow, icol).Color = RGB(255, 0, 255)
End Select
Next icol
Next irow
End Sub``````

##### Board Regular
Thanks, that fixed that part. Could you also tell me what's wrong with the case action statements?

##### Board Regular
Actually, never mind. I just needed to place interior before .color.

Thanks for the help.

Replies
1
Views
53
Replies
6
Views
126
Replies
0
Views
100
Replies
7
Views
67
Replies
1
Views
47