Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,069
Default Format Chart Bars with code?

I have data laid out in 3 columns... date in the first, a number in the
second,and a color (Green, Red, or Blue) in the next. I have a chart with
floating bars and would like them to be the color of the color in column
three. Can I do that with code? Is there a better way?
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Format Chart Bars with code?

The conditional chart technique on this web page works without any VBA:

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

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


"John" wrote in message
...
I have data laid out in 3 columns... date in the first, a number in the
second,and a color (Green, Red, or Blue) in the next. I have a chart with
floating bars and would like them to be the color of the color in column
three. Can I do that with code? Is there a better way?



  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,069
Default Format Chart Bars with code?

yea, I was hoping you wouldn't say that... I have made my own candle charts
with multiple series for up/down open/close etc... using that technique. I
was hoping there was an easier way then reworking all those series

"Jon Peltier" wrote:

The conditional chart technique on this web page works without any VBA:

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

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


"John" wrote in message
...
I have data laid out in 3 columns... date in the first, a number in the
second,and a color (Green, Red, or Blue) in the next. I have a chart with
floating bars and would like them to be the color of the color in column
three. Can I do that with code? Is there a better way?




  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 235
Default Format Chart Bars with code?

Would this general example work? It assumes the colors are in column C.
Create a bar chart, activate it, and run the code.

Sub ColorBars()

Dim Rng As Range
Dim Color As Integer

Color = Range("C1").Interior.ColorIndex
Set Pts = ActiveChart.SeriesCollection(1).Points(1)
Pts.Interior.ColorIndex = Color

Color = Range("C2").Interior.ColorIndex
Set Pts = ActiveChart.SeriesCollection(1).Points(2)
Pts.Interior.ColorIndex = Color

Color = Range("C3").Interior.ColorIndex
Set Pts = ActiveChart.SeriesCollection(1).Points(3)
Pts.Interior.ColorIndex = Color

End Sub

-- Can be modified to work more efficiently by looping, etc.


--
John


"John" wrote:

yea, I was hoping you wouldn't say that... I have made my own candle charts
with multiple series for up/down open/close etc... using that technique. I
was hoping there was an easier way then reworking all those series

"Jon Peltier" wrote:

The conditional chart technique on this web page works without any VBA:

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

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


"John" wrote in message
...
I have data laid out in 3 columns... date in the first, a number in the
second,and a color (Green, Red, or Blue) in the next. I have a chart with
floating bars and would like them to be the color of the color in column
three. Can I do that with code? Is there a better way?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
In a chart how do I make the bars bigger? doxylady Charts and Charting in Excel 3 May 15th 23 03:43 AM
is there a way to make the bars on a bar chart narrower? mcarrington Excel Discussion (Misc queries) 2 January 5th 06 11:08 PM
2 Bars and 2 Y Axis Chart DG Charts and Charting in Excel 1 October 4th 05 03:03 AM
Bars in a chart??????? Gee Excel Worksheet Functions 0 July 15th 05 11:36 AM
How to customize error bars by VB code? [email protected] Charts and Charting in Excel 1 May 31st 05 07:55 PM


All times are GMT +1. The time now is 01:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"