VBA formatting a shape

Pavertheway

New Member
Joined
Nov 5, 2018
Messages
47
Hi,

I have percentage values in certain cells on a sheet (E3 currently displays 84% for example). I would like a shape which takes the value of E3, and then applies that percentage to a gradient fill level of the shape, starting at the bottom.

So if the shape (an Oval), was to take 50%, then the bottom half of it would be blue, and the top half empty.

Is this possible to do in VBA? I know I can use conditional formatting to match 50% to a specific colour, but I don't think conditional formatting can be used to apply to a gradient fill (as far as I know, I am very willing to be proved wrong!)

Any help would be greatly appreciated.

Thank you!
 
Perhaps ...
Place in sheet module of sheet containing the 7 rectangles - runs when that sheet is activated
Code:
Private Sub Worksheet_Activate()
    Call GradShape
End Sub

Or ...
Put in sheet module for Sheet4 (may not fire if values in Sheet4 are auto-updated)
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Call GradShape
End Sub
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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