Thread: Formula error
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Shu of AZ Shu of AZ is offline
external usenet poster
 
Posts: 130
Default Formula error

Did not change any results, see below,

Worksheets(R12).Select

Select Case SaddleBlanket
Case Is = 1
Selection.Interior.ColorIndex = 3
Case Is = 2
Selection.Interior.ColorIndex = 2
Case Is = 3
Selection.Interior.ColorIndex = 41
Case Is = 4
Selection.Interior.ColorIndex = 6
Case Is = 5
Selection.Interior.ColorIndex = 50
Case Is = 6
Selection.Interior.ColorIndex = 1
Case Is = 7
Selection.Interior.ColorIndex = 46
Case Is = 8
Selection.Interior.ColorIndex = 7
Case Is = 9
Selection.Interior.ColorIndex = 42
Case Is = 10
Selection.Interior.ColorIndex = 13
Case Is = 11
Selection.Interior.ColorIndex = 48
Case Is = 12
Selection.Interior.ColorIndex = 4
End Select

"FSt1" wrote:

hi
i've never seen it done quite like this so i'll offer a suggestion.
Worksheets(R12).Select
'Selection.Interior 'remove

Select Case SaddleBlanket
Case Is = 1
Selection.interior.ColorIndex = 3
Case Is = 2
Selection.interior.ColorIndex = 2
Case Is = 3
ect...ect

Regards
FSt1

"Shu of AZ" wrote:

Could you look at the below formula for Select Case and tell me what is
incorrect. It does not perform correctly on the worksheet.

Const SaddleBlanket = "O5:O43"
Dim SaddleBlanket As String

Worksheets(R12).Select
Range(SaddleBlanket).Select
Selection.Interior

Select Case SaddleBlanket
Case Is = 1
Selection.ColorIndex = 3
Case Is = 2
Selection.ColorIndex = 2
Case Is = 3
Selection.ColorIndex = 41
Case Is = 4
Selection.ColorIndex = 6
Case Is = 5
Selection.ColorIndex = 50
Case Is = 6
Selection.ColorIndex = 1
Case Is = 7
Selection.ColorIndex = 46
Case Is = 8
Selection.ColorIndex = 7
Case Is = 9
Selection.ColorIndex = 42
Case Is = 10
Selection.ColorIndex = 13
Case Is = 11
Selection.ColorIndex = 48
Case Is = 12
Selection.ColorIndex = 4
End Select