Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Cell Colour based on the values in a different range of cells

Status
Not open for further replies.

EliseFreedman

Programmer
Dec 6, 2002
470
GB
Hi There

I am working on a spreadsheet which is going to have a scoring system behind it.

Basically what will happen is that users will select values for a range of indicators. If ANY of the values in the range are Red, then the overall score should be red. I tried to use the code below but it didnt seem to be working. Im not sure where I am going wrong.

Code:
Dim NxtRow

For NxtRow = 7 To 15
    If Range("G" & NxtRow).Interior.ColorIndex = 45 Then
        Range("G16").Interior.ColorIndex = 45
        Else
         Range("G16").Interior.ColorIndex = 0
    End If
Next

Can anyone help
 



Hi,

So the overall score is in row 16?
Code:
Dim NxtRow as long, r as range, ci

For NxtRow = 7 To 15
   for each r in interesect(rows(NxtRow), ActiveSheet.UsedRange) 
      ci = r.interior.colorindex
      select case ci
         case xlNone
            ci = xlNone
      end select
      cells(16, r.column).interior.colorindex = ci
   next
Next


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I thought the color index for red was 3 instead of 45.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top