Fill Color

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,134
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
this code is all perfect and correct, I am trying to do one change and in the end " Case Else: sRGB = "0,176,80" 'Green" i want to add these color's start:- 0,109,42 Mid:- 0,158,65 End:- 0,189,79 and this condition is only for Green. rest color and conditions will not change.

Is there a way to modify this.


VBA Code:
Sub fillcolorRetOLT()
  
  Dim i As Long
  Dim a As Long
  Dim sRGB As String
  Dim vRGB As Variant
  
  'On Error Resume Next
  For i = 1 To 13
    Select Case Sheet4.Cells(i + 3, 30).Value
     ' Case Is > 40: sRGB = "255,0,0"
     Case Is < 90: sRGB = "255,0,0"   'Red
     Case Is <= 98.5: sRGB = "255,255,0"  'yellow
     Case Is <= 99.9: sRGB = "146,208,80"   'Light Green
     Case Else: sRGB = "0,176,80"         'Green
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Case Else: sRGB = "0,176,80"         'Green
'I want to add the 3 color conditions here
'start:- 0,109,42  Mid:- 0,158,65  End:- 0,189,79
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    End Select
    vRGB = Split(sRGB, ",")
    Sheet4.Shapes.Range(Array("Rectangle " & i)).Fill.ForeColor.RGB = RGB(vRGB(0), vRGB(1), vRGB(2)) ', vRGB(3))
    
    Next i
  
End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top