Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Co-op Bank
 
Posts: n/a
Default 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   Report Post  
Andy Pope
 
Posts: n/a
Default

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   Report Post  
Co-op Bank
 
Posts: n/a
Default

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
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
Timeline Chart? ckrogers Charts and Charting in Excel 3 March 17th 05 09:20 PM
Chart formatting Christianovitch Charts and Charting in Excel 1 January 19th 05 10:55 PM
Problem with xlusrgal.xls file Alfred S C Lee Charts and Charting in Excel 2 December 29th 04 05:54 PM
Impedding/Overlaying Charts Phil Hageman Charts and Charting in Excel 4 December 17th 04 07:25 PM
pivot table multi line chart souris Charts and Charting in Excel 2 December 7th 04 03:56 AM


All times are GMT +1. The time now is 07:52 AM.

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

About Us

"It's about Microsoft Excel"