LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default 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



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 97 Enum Larry Dodd[_2_] Excel Programming 5 April 11th 05 11:15 AM
Enum Daniel[_4_] Excel Programming 3 December 22nd 03 12:30 AM
Enum in Excel 97 Rob Bovey Excel Programming 0 September 26th 03 11:02 PM
Enum in Excel 97 Chip Pearson Excel Programming 0 September 26th 03 10:03 PM


All times are GMT +1. The time now is 06:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"