Enum type variables
Good Morning Back at ya KC,
Try this bit of Code, It should be much more simple to use, and
Understand..
enjoy, Rick
Sub test()
Dim k As Integer
Dim sun As Integer
sun = 6
For k = 1 To Cells(1, 1).End(xlToRight).Column
If Cells(1, k).value = "Sun" Then
Columns(k).Interior.ColorIndex = sun
End If
Next k
End Sub
"KC" wrote in message
...
Good morning
For exercise,
I have weekdays in row 1, Sun, Mon, Tue...Sat and repeat
To highlight every Sunday, I use this code below.
I would like to seek advice if I can read contents in cells as value in
the
enum variable, ie can I get rid of the first set of select case please?
Enum wkdays
sun = 6
End Enum
Sub test()
Dim eidx As wkdays
For k = 1 To Cells(1, 1).End(xlToRight).Column
Select Case Cells(1, k)
Case "Sun"
eidx = sun
Case Else
eidx = 0
End Select
Select Case eidx
Case sun
Columns(k).Interior.ColorIndex = sun
End Select
Next k
End Sub
|