Results 1 to 6 of 6

Thread: Excel Function and Excel Chart Colors

  1. #1
    Join Date
    Aug 2006
    Posts
    162

    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 :
    1. The player's name shown horizontally
    2. The player's score shown vertically
    3. The player's exposure time to the subject, shown by the color of their bar
    Is there any Excel function that is able to do this?? If anyone having idea please help me. Also I simply have to go through and hand-pick the color each individual column one by one??
    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. #2
    Join Date
    Jan 2008
    Posts
    3,755

    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. #3
    Join Date
    Apr 2008
    Posts
    4,088

    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

  4. #4
    Join Date
    Apr 2008
    Posts
    4,642

    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. #5
    Join Date
    May 2008
    Posts
    390

    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. #6
    Join Date
    Sep 2005
    Posts
    1,306

    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.

Similar Threads

  1. How to disable excel for taking empty cell in Excel chart
    By Hache hi in forum MS Office Support
    Replies: 2
    Last Post: 25-02-2012, 12:30 PM
  2. There is no data in Excel Pie Chart
    By Tarani in forum MS Office Support
    Replies: 2
    Last Post: 25-02-2012, 12:27 PM
  3. Using chart with multiple variables in Excel
    By Rounder1 in forum MS Office Support
    Replies: 8
    Last Post: 25-02-2012, 12:11 PM
  4. How to start Excel chart at zero
    By Hameeda-K in forum Windows Software
    Replies: 2
    Last Post: 05-01-2012, 04:38 PM
  5. To change Gridlines Colors in Excel
    By Antrix in forum Windows Software
    Replies: 3
    Last Post: 27-03-2009, 12:38 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,265,708.88423 seconds with 17 queries