User-Defined Formatting

Apply special Conditional Formatting, color cells based on their values.
This was coded before Microsoft added Conditional Formatting into Excel2007.
Can be used as special conditional formatting

Private Sub Worksheet_Change(ByVal Target As Range)
 Dim icolor
 If Int(Target.Row / 4) = Target.Row / 4 Then
  Select Case Target.Offset(1).Value
  Case -10 To 0
   icolor = 36
  Case 1 To 7
   icolor = 44
  Case 8 To 15
   icolor = 45
  Case 16 To 30
   icolor = 46
  Case 31 To 300
   icolor = 3
  Case Else
   icolor = RGB(1, 1, 1)
  End Select
  Target.Offset(2).Interior.Color = icolor
End If
End Sub

Target As Range

Views 98 Downloads 54

'conditional formatting', 'conditional', 'formatting', 'cell', 'value', 'color', 'colour', 'format'

ANmarAmdeen
414
Attachments
Graphics VBA-Excel
Revisions

v1.0