ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Changing color of single bar based on x-axis date value (https://www.excelbanter.com/charts-charting-excel/103101-changing-color-single-bar-based-x-axis-date-value.html)

[email protected]

Changing color of single bar based on x-axis date value
 
I have a bar chart with numeric values for the y-axis, and Month-Year
values for the x-axis values. I would like to be able to use VBA to
change the color of just one of the bars whose x-axis value corresponds
to a specific month-year, like Jun-05 (The month-year could be text, if
that makes the example easier). Does anyone have a snippet of code that
would allow me to automate the coloring of just one bar based on the
x-axis value?

Thanks,

Carroll Rinehart
Bel Air, MD


Jon Peltier

Changing color of single bar based on x-axis date value
 
You don't need VBA; you can make a conditional chart using one or more extra
series:

http://peltiertech.com/Excel/Charts/...nalChart1.html

If you want to use VBA for some other reason, you could adjust the last
couple macros in this article (it's about pie charts, but the macros
shouldn't care):

http://pubs.logicalexpressions.com/P...cle.asp?ID=390

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


wrote in message
ups.com...
I have a bar chart with numeric values for the y-axis, and Month-Year
values for the x-axis values. I would like to be able to use VBA to
change the color of just one of the bars whose x-axis value corresponds
to a specific month-year, like Jun-05 (The month-year could be text, if
that makes the example easier). Does anyone have a snippet of code that
would allow me to automate the coloring of just one bar based on the
x-axis value?

Thanks,

Carroll Rinehart
Bel Air, MD




[email protected]

Changing color of single bar based on x-axis date value
 
Thanks Jon for taking the time to provide more than one solution.

Carroll



All times are GMT +1. The time now is 10:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com