MissLady11
New Member
Hi all, new to the site, really new to VBA but this is what I'm trying to do:
In the % Request Responded to column on the attached worksheet, I want to change the shape color based on the percent next to it per the legend at the bottom of the table section.
I only know the long way to do this but would like to loop and not repeat the same code for each group (BSS, OSS, EBI, CBT.....) can someone help me figure out how to set this code up to where I can say for the range of cells in T9-T51, where there is a value, change the shape next to it to red, green or yellow. I have named both the value cell an the shape: below is what I would have to continue for each group if I do this my way....
Private Sub Worksheet_Activate()
If Worksheets("PP Dashboard template").Range("T9").Value < 75 Then
Shapes("BSSAdminDot").Fill.ForeColor.RGB = RGB(192, 0, 0)
ElseIf Worksheets("PP Dashboard template").Range("T9").Value > 75 And Range("T9").Value <= 95 Then
Shapes("BSSAdminDot").Fill.ForeColor.RGB = RGB(203, 108, 29)
ElseIf Worksheets("PP Dashboard template").Range("T9").Value > 95 Then
Shapes("BSSAdminDot").Fill.ForeColor.RGB = RGB(119, 147, 60)
End If
If Worksheets("PP Dashboard template").Range("T12").Value < 75 Then
Shapes("OSSAdminDot").Fill.ForeColor.RGB = RGB(192, 0, 0)
ElseIf Worksheets("PP Dashboard template").Range("T12").Value > 75 And Range("T12").Value <= 95 Then
Shapes("OSSAdminDot").Fill.ForeColor.RGB = RGB(203, 108, 29)
ElseIf Worksheets("PP Dashboard template").Range("T12").Value > 95 Then
Shapes("OSSAdminDot").Fill.ForeColor.RGB = RGB(119, 147, 60)
End If
End Sub
In the % Request Responded to column on the attached worksheet, I want to change the shape color based on the percent next to it per the legend at the bottom of the table section.
I only know the long way to do this but would like to loop and not repeat the same code for each group (BSS, OSS, EBI, CBT.....) can someone help me figure out how to set this code up to where I can say for the range of cells in T9-T51, where there is a value, change the shape next to it to red, green or yellow. I have named both the value cell an the shape: below is what I would have to continue for each group if I do this my way....
Private Sub Worksheet_Activate()
If Worksheets("PP Dashboard template").Range("T9").Value < 75 Then
Shapes("BSSAdminDot").Fill.ForeColor.RGB = RGB(192, 0, 0)
ElseIf Worksheets("PP Dashboard template").Range("T9").Value > 75 And Range("T9").Value <= 95 Then
Shapes("BSSAdminDot").Fill.ForeColor.RGB = RGB(203, 108, 29)
ElseIf Worksheets("PP Dashboard template").Range("T9").Value > 95 Then
Shapes("BSSAdminDot").Fill.ForeColor.RGB = RGB(119, 147, 60)
End If
If Worksheets("PP Dashboard template").Range("T12").Value < 75 Then
Shapes("OSSAdminDot").Fill.ForeColor.RGB = RGB(192, 0, 0)
ElseIf Worksheets("PP Dashboard template").Range("T12").Value > 75 And Range("T12").Value <= 95 Then
Shapes("OSSAdminDot").Fill.ForeColor.RGB = RGB(203, 108, 29)
ElseIf Worksheets("PP Dashboard template").Range("T12").Value > 95 Then
Shapes("OSSAdminDot").Fill.ForeColor.RGB = RGB(119, 147, 60)
End If
End Sub