Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Co-op Bank
 
Posts: n/a
Default VBA Wildcards - HELP!

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
Manchester, England
  #2   Report Post  
Debra Dalgleish
 
Posts: n/a
Default

You can use the Left function, e.g.:

Select Case Left(WorksheetFunction.Index(.XValues, iPoint), 16)
Case "Personal Banking"
.Points(iPoint).Interior.ColorIndex = 6 ' Yellow

Instead of 16, use any number of characters that will uniquely identify
the categories.

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
Manchester, England



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

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
Wildcards with SumProduct pomalley Excel Worksheet Functions 7 March 24th 05 03:01 PM
Using Wildcards in Sheet selection Jamie Excel Worksheet Functions 1 March 18th 05 02:21 PM
Replace using wildcards jeb Excel Discussion (Misc queries) 6 January 6th 05 03:35 PM
How can I find strings of wildcards in Excel? Nick M Excel Discussion (Misc queries) 2 December 20th 04 05:59 PM


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

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

About Us

"It's about Microsoft Excel"