|
| |||||||||
| Tags: chart colors, colorindex, excel, function, vba, worksheet |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| Excel Function and Excel Chart Colors
I am given the task in Excel to complete. I have to make a chart showing 3 different pieces of information :
__________________ Processor: AMD Athlon(tm) 64 X2 Dual Core @ ~2.2 GHz Memory: 1024MB RAM Hard Drive: 200 GB Video Card: RADEON X300/X550 Series |
|
#2
| ||||
| ||||
| Re: Excel Function and Excel Chart Colors
By using the VBA you can use the more conditions like you can set your own case ranges, colour values, and target range. I think that this code will work for you requirement : Private Sub Worksheet1_Change(ByVal Target As Range) Dim icolour As Integer If Not Intersect(Target, Range("A1")) Is Nothing Then Select Case Target Case 0 To 25 icolour = 2 Case 26 To 50 icolour = 3 Case 51 To 75 icolour = 4 Case 75 To 100 icolour = 5 End Select Target.Interior.ColorIndex = icolour End If End Sub |
|
#3
| ||||
| ||||
| Re: Excel Function and Excel Chart Colors
According to me even this code is useful for Excel Chart Colors : The only thing is you'll have to set the colorindex property yourself : ActiveSheet.ChartObjects("Chart 1").Activate ActiveChart.SeriesCollection(1).Points(1).Select With Selection.Interior .Pattern = xlSolid .ColorIndex = 40 End With ActiveChart.SeriesCollection(1).Points(2).Select With Selection.Interior .Pattern = xlSolid .ColorIndex = 15 End With ActiveChart.SeriesCollection(1).Points(3).Select With Selection.Interior .Pattern = xlSolid .ColorIndex = 25 End With
__________________ Ram requirement for various OS |
|
#4
| ||||
| ||||
| Re: Excel Function and Excel Chart Colors
Depending on the value of it's respective "time" cell, if you are making the color every bar on the chart on your spreadsheet then you can use the following : ActiveChart.SeriesCollection(1).Points(n).Select With Selection.Interior .Pattern = xlSolid .ColorIndex = c End With |
|
#5
| ||||
| ||||
| Re: Excel Function and Excel Chart Colors
You can also use this code : ActiveChart.SeriesCollection(1).Points(3).Select With Selection.Interior .Pattern = xlSolid if cells(1,1).value = 2 then .ColorIndex = 20 elseif cells(1,1).value = 2 then .Colorindex = 15 end if End With This code has been modified so that the color can be conditional. |
|
#6
| ||||
| ||||
| Re: Excel Function and Excel Chart Colors
The code mentioned by the "Zenon" should work. Also I would like to tell that you will need to write the same code for every bar of the chart, and substitute the point numbers, colorindex and cells(r,c) for whatever's in your spreadsheet. The Cells(r,c) indicates the Row & Column containing the conditions which determine how the bars are colored. According to me you can also use the Selection.Interior.Colorindex = c instead of using the With --- End With blocks. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Excel Function and Excel Chart Colors" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to copy colors from another workbook to new in Microsoft Excel | Talisha | MS Office Support | 3 | 2 Weeks Ago 05:09 PM |
| How to start Excel chart at zero | Hameeda-K | Windows Software | 2 | 05-01-2012 04:38 PM |
| Excel 2007 chart templates | raviranch | Windows Software | 2 | 13-07-2009 02:30 PM |
| Convert a Excel chart in Image | Reece | Windows Software | 2 | 09-04-2009 02:30 PM |
| To change Gridlines Colors in Excel | Antrix | Windows Software | 3 | 27-03-2009 01:38 PM |