Button to color a selected bar in a chart

3nity

New Member
Joined
Aug 16, 2016
Messages
1
Hi everyone

I'm new user of this awesome forum.

Basically, I got a bar chart, and I want to be able to select 1 individual bar and with a click on a button, that selected bar change to color RED or any other attributes (3D, shadow, etc). Is that possible with VBA ? :eek:

Please help me

Thanks so much for your time and precious effort.

J
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hello 3nity,

VBA has the capability to do (almost) anything you can manually do in Excel. The basic syntax would be as follows:

Code:
Sub ChangeDataPoint()


ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.SeriesCollection(1).Points(1).Format.Fill.ForeColor.RGB = RGB(255, 0, 0)


End Sub

This changes the first data point on "Chart 2" to the colour red. Without knowing the specifics of what you need doing, i can't really offer much more help.

Hopefully you can adapt it to you needs

Thanks
Caleeco
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,937
Members
449,094
Latest member
teemeren

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