View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Six conditional formatting possible?

As an example, tinker with this sheet sub* which conditionally colors (both
fill colors and font colors) in cols A to T (20 cols) based on the numeric
values -- between 1-30, inclusive -- in col U (within U2:U100)
*from a Mike H posting

To install:
Copy the sub
Right-click on the sheet tab View Code
Paste the sub into the code window on the right
Press Alt + Q to get back to Excel
Test it out by inputting various numbers** with U2:U100
**between 1 - 30

'-------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("U2:U100")) Is Nothing Then
Select Case Target
Case 1 To 5
icolor = 6
fcolor = 1
Case 6 To 10
icolor = 12
fcolor = 1
Case 11 To 15
icolor = 7
fcolor = 1
Case 16 To 20
icolor = 53
fcolor = 1
Case 21 To 25
icolor = 15
fcolor = 1
Case 26 To 30
icolor = 42
fcolor = 1
Case Else
End Select
With Target
.Offset(0, -20).Resize(1, 20).Interior.ColorIndex = icolor
.Offset(0, -20).Resize(1, 20).Font.ColorIndex = fcolor
End With
End If
End Sub
'------

--
Max
Singapore
http://savefile.com/projects/236895
Downloads:20,500 Files:363 Subscribers:64
xdemechanik
---
"ghinzrey" wrote:
Is there any alternative way to create six or more conditional formatting and
how can I save my formats? User is on self study and would appreciate step by
step method on how to create if there's any. Thanks