ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,227
- Office Version
- 2007
- Platform
- Windows
Morning,
Just for my learning curve.
Below is a code that works fine as long as say TUESDAY is entered into a cell.
If a user types Tuesday, tuesday etc etc has no affect.
How is this overcome so the code doesnt just allow UPPERCASE but either UPPER / LOWER case.
Thanks very much.
Just for my learning curve.
Below is a code that works fine as long as say TUESDAY is entered into a cell.
If a user types Tuesday, tuesday etc etc has no affect.
How is this overcome so the code doesnt just allow UPPERCASE but either UPPER / LOWER case.
Thanks very much.
Rich (BB code):
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim My_Range As Range
Dim LastRow As Long
Set My_Range = Worksheets("COLOR CELLS").Range("A1:Z50")
For Each cell In My_Range
If cell.Value Like "MONDAY" Then
cell.Interior.ColorIndex = 3
ElseIf cell.Value Like "TUESDAY" Then
cell.Interior.ColorIndex = 4
ElseIf cell.Value Like "WEDNESDAY" Then
cell.Interior.ColorIndex = 22
ElseIf cell.Value Like "THURSDAY" Then
cell.Interior.ColorIndex = 6
ElseIf cell.Value Like "FRIDAY" Then
cell.Interior.ColorIndex = 7
ElseIf cell.Value Like "SATURDAY" Then
cell.Interior.ColorIndex = 8
ElseIf cell.Value Like "SUNDAY" Then
cell.Interior.ColorIndex = 46
Else
cell.Interior.ColorIndex = xlNone
End If
Next
End Sub