Gradient fill macro

thinksriniii

Board Regular
Joined
Apr 1, 2009
Messages
93
Hi Guys,

I am trying to use a VBA script to fill a shape with Green and Amber based on the value in the column D.

1) If the value is equal to 1 then the shape needs to be filled totally by green
2) If the value is closer to 0 then the shape needs to be filled by Amber

The problem is point 1 is not working properly.

Sub Update_Status()
With Worksheets("Status").Shapes("Rectangle 1").Fill
.TwoColorGradient Style:=msoGradientVertical, Variant:=1
.ForeColor.RGB = RGB(154, 205, 50)
.BackColor.RGB = RGB(255, 140, 0)
.GradientStops.Insert RGB(255, 140, 0), Sheets("completed").Range("D3").Value
End With

Thanks in advance
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi Guys,

I am trying to use a VBA script to fill a shape with Green and Amber based on the value in the column D.

1) If the value is equal to 1 then the shape needs to be filled totally by green
2) If the value is closer to 0 then the shape needs to be filled by Amber

The problem is point 1 is not working properly (Still the shape has some amber in it).



Thanks in advance

any suggestion guys?
 
Upvote 0

Forum statistics

Threads
1,223,204
Messages
6,170,728
Members
452,353
Latest member
strainu

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