View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kevin Kevin is offline
external usenet poster
 
Posts: 134
Default Simple one? How to shade an offset cell...

Part of my code puts a value into an offset cell;
depending on the value of that cell, I want to shade the
cell a certain colour. Is there an easier way to do this,
ideally calling another generic subroutine....here is what
I have now:

ActiveCell.Offset(0, 60).Value = cprodrate
If cprodrate 0.9 Then
With ActiveCell.Offset(0, 60).Interior
.ColorIndex = 4
.Pattern = xlSolid
End With
ElseIf cprodrate 0.75 Then
With ActiveCell.Offset(0, 60).Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
ElseIf cprodrate 0.01 Then
With ActiveCell.Offset(0, 60).Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
End If

I will have various other offset cells (i.e. (0,61) &
(0,62) that I would like to do the same thing with...can I
build this into the first line with a one-liner somehow?