+ Reply to Thread
Results 1 to 3 of 3

PIE CHART EXPERT HELP REQUIRED

  1. #1
    Co-op Bank
    Guest

    PIE CHART EXPERT HELP REQUIRED

    Hello, i'm working in Excel 2000 and I have some VBA code (taken from
    http://pubs.logicalexpressions.com/P...cle.asp?ID=390) which gives
    a segment in a Pie Chart a colour baed on its description. Unfortunatley the
    suffix of the segment is always different so I would like to use a wildcard
    for the suffix. A typical segment description is "Personal Banking - £100k".
    I have tried to insert a wildcard into the code but it does not work (i.e.
    change the segment colour), any suggestions?

    'Case "Personal Banking - *"
    .Points(iPoint).Interior.ColorIndex = 13 ' Purple'

    If I type in 'Case "Personal Banking - £100k"
    .Points(iPoint).Interior.ColorIndex = 13 ' Purple' it
    works fine but with the suffix changing as the data changes its not practical
    to manually adjust the code.
    Please help.

    Thanks
    Brian


  2. #2
    Andy Pope
    Guest

    Re: PIE CHART EXPERT HELP REQUIRED

    Hi Brian,

    You may have to use IF THEN tests rather than select.
    Something like this,

    If WorksheetFunction.Index(.XValues, iPoint) _
    Like "Personal Banking - *" Then
    .Points(IPoint).Interior.ColorIndex = 13 ' Purple'
    ElseIf WorksheetFunction.Index(.XValues, iPoint) _
    Like "Business Banking - *" Then
    .Points(IPoint).Interior.ColorIndex = 3
    End If

    Cheers
    Andy

    Co-op Bank wrote:
    > Hello, i'm working in Excel 2000 and I have some VBA code (taken from
    > http://pubs.logicalexpressions.com/P...cle.asp?ID=390) which gives
    > a segment in a Pie Chart a colour baed on its description. Unfortunatley the
    > suffix of the segment is always different so I would like to use a wildcard
    > for the suffix. A typical segment description is "Personal Banking - £100k".
    > I have tried to insert a wildcard into the code but it does not work (i.e.
    > change the segment colour), any suggestions?
    >
    > 'Case "Personal Banking - *"
    > .Points(iPoint).Interior.ColorIndex = 13 ' Purple'
    >
    > If I type in 'Case "Personal Banking - £100k"
    > .Points(iPoint).Interior.ColorIndex = 13 ' Purple' it
    > works fine but with the suffix changing as the data changes its not practical
    > to manually adjust the code.
    > Please help.
    >
    > Thanks
    > Brian
    >


    --

    Andy Pope, Microsoft MVP - Excel
    http://www.andypope.info

  3. #3
    Co-op Bank
    Guest

    Re: PIE CHART EXPERT HELP REQUIRED

    Thats excellent, worked first time. THANKS!

    "Andy Pope" wrote:

    > Hi Brian,
    >
    > You may have to use IF THEN tests rather than select.
    > Something like this,
    >
    > If WorksheetFunction.Index(.XValues, iPoint) _
    > Like "Personal Banking - *" Then
    > .Points(IPoint).Interior.ColorIndex = 13 ' Purple'
    > ElseIf WorksheetFunction.Index(.XValues, iPoint) _
    > Like "Business Banking - *" Then
    > .Points(IPoint).Interior.ColorIndex = 3
    > End If
    >
    > Cheers
    > Andy
    >
    > Co-op Bank wrote:
    > > Hello, i'm working in Excel 2000 and I have some VBA code (taken from
    > > http://pubs.logicalexpressions.com/P...cle.asp?ID=390) which gives
    > > a segment in a Pie Chart a colour baed on its description. Unfortunatley the
    > > suffix of the segment is always different so I would like to use a wildcard
    > > for the suffix. A typical segment description is "Personal Banking - £100k".
    > > I have tried to insert a wildcard into the code but it does not work (i.e.
    > > change the segment colour), any suggestions?
    > >
    > > 'Case "Personal Banking - *"
    > > .Points(iPoint).Interior.ColorIndex = 13 ' Purple'
    > >
    > > If I type in 'Case "Personal Banking - £100k"
    > > .Points(iPoint).Interior.ColorIndex = 13 ' Purple' it
    > > works fine but with the suffix changing as the data changes its not practical
    > > to manually adjust the code.
    > > Please help.
    > >
    > > Thanks
    > > Brian
    > >

    >
    > --
    >
    > Andy Pope, Microsoft MVP - Excel
    > http://www.andypope.info
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1