conditional shading

G

Gary

The spreadsheet has 8 columns (B-I) and 25 rows. Column B has dates, the
other 7 columns various information that happened on that date. The dates
in column B might take up various numbers of rows; for example B1:B5 =
5/7/07, B6:B:7 = 5/8/07, B8:B20 = 5/9/07, B21 = 5/10/07 and B20:B25 = blank.

We wish to alternate shading of all rows associated with one date. For
example using the above scenario the rows associated with; B1:B5 = green,
B6:B7 = yellow, B8:B20 = green, B21 = yellow and B20:B25 = no color.

Is there a conditional format that can accomplish this?

Regards,
Gary
 
D

Don Guillett

right click sheet tab>view code>insert this>change colors to suit>put dates
in range(b1:b4) or put dates into macro itself instead of range.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("b7:b77")) Is Nothing Then
Select Case Target.Value
Case Is = Range("b1"): x = 3
Case Is = Range("b2"): x = 5
Case Is = Range("b3"): x = 6
Case Is = Range("b4"): x = 7
Case Else
End Select
Rows(Target.row).Interior.ColorIndex = x
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top