View Full Version : Required VBA code to change Color of chart & also formatting

12-16-2018, 11:45 PM

12-16-2018, 11:47 PM

sample VBA Macro file file attached for reference

12-17-2018, 01:22 AM
one more sample sheet attached with macro.in this sheet chart data color change by vertical & i want it will be change horizontally,can you modified this?

12-17-2018, 01:22 AM

12-19-2018, 09:28 PM
Good Morning All

Can any one help me on this issue?

12-24-2018, 09:49 PM
Hi amartakale!
Maybe this is useful.

Sub ColorChartBarsbyCellColor1()
Dim txt As String, i As Integer
c = ActiveChart.SeriesCollection.Count
For i = 1 To c
txt = ActiveChart.SeriesCollection(i).Formula
arr = Split(txt, ",")
With ActiveChart.Legend.LegendEntries(i)
Set vaddress = ActiveSheet.Range(arr(2))
.LegendKey.Interior.Color = vaddress.Cells(1).Interior.Color
End With
Next i
End Sub

12-25-2018, 07:25 AM
Actually I take exception to the poor communication attached to this particular thread. Whilst the thread title suggests something, its the very lack of a detailed explanation, which sums up why most people will simply bypass this thread.

Take the time to clearly set out the issue. Describe what it is that you think you need as a end result for the issue and then you will find other wanting to assist.

12-26-2018, 10:16 PM
Thanks Sir,sorry for late reply.Next time I take care for complicated Question.

Above code is perfect for Bar Chart (if horizontal data) then perfect work for color.

but there are different type of chart in my work how to modified this code to all Chart (Bar Chart,Pie Chart,Line Chart....also Data are Horizontal & Vertical way).If I change data color without heading then Chart color change by VBA automatically ,how it can possible?

Thanks once again

12-28-2018, 04:41 AM
Really? How about telling the people what you think the issue is, what you would like as a result? Then we can decide what assistance we might be able to offer. Any other request such as post @8 is rude. Please think clearly about the fact you are posting to a world wide audience therefore what you might post to another person in India wont work here.

01-01-2019, 07:11 PM
You can judge chart types for different processing.
The appendix is a simple example.