K
KC
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
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