Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Border color of chart

Status
Not open for further replies.

mellen

Programmer
Nov 11, 2002
7
CA
Ok, I have a whole bunch of charts and I need to change the color of the x and y axis along with the outer border surrounding the graph.

I've been looking and haven't had any luck.

 
You need to manipulate the colorindex property of the following objects:

activechart.axes(xlvalue).border
activechart.axes(xlcategory).border
activechart.plotarea.border

Rob
[flowerface]
 
Ok, I tried and for the life of me, can't figure it out.

Here's my code
ActiveWindow.Visible = False
Windows("New Storage Graph.xls").Activate
Range("G32").Select
Sheets("New Charts").Select

ActiveSheet.ChartObjects("Chart 9").Activate

'Changing border color PROBLEM IS BELOW
ActiveChart.Axes(xlValue, xlSecondary).Select
With Selection.Border
.ColorIndex = 16
End With

ActiveChart.SeriesCollection(1).Select
With Selection.Border
.ColorIndex = 43
.Weight = xlThin
.LineStyle = xlContinuous
End With
 
Share with us WHAT is not working! Are you getting an error? Nothing happens? From what I see, your code will
- change the color of the SECONDARY y axis (provided your chart has one, on the right of your graph)
- change the color of the first series plotted on your graph

Note that you don't need to select and then modify (even though that is what the macro recorder will produce) - it's quicker to modify directly, e.g.

activechart.seriescollection(1).border.colorindex=43

Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top