VBA Code to change 1 series to vary colors by point

anthonyexcel

Active Member
Joined
Jun 10, 2011
Messages
258
Office Version
  1. 365
Platform
  1. Windows
I have 3 series in a chart. Is it possible to get one of the series in a to vary colors by point without changing them manually?
 
Last edited:

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Yes. If you click on a series, you activate that series.
If you click again on a point of that series, you can format the selected point - and only that one.
This way, you can choose several colors or other formatting options.
 
Upvote 0
wigi, thanks for your response. I understand that part I not looking to click on a selected point just wondered if there was a way of getting around that in VBA. My ultimate goal is to have one of the series color by point automatically. Lets say that series 1 is red, series 2 is green and series 3 is blue. I would like to take series 3 and have it automatically color itself with different colors. Is this do able in VBA?
 
Upvote 0
Here is a VBA code example. It will operate on the active chart:

Code:
Sub ColorChartSeriesPoints()
    For Each pt In ActiveChart.SeriesCollection(3).Points
        pt.Interior.ColorIndex = Int(Rnd * 56)
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,462
Members
452,915
Latest member
hannnahheileen

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