Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Wildcards in Excel VBA - 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Wildcards in Excel VBA - HELP

if you know exactly how many characters are same them you can use
left() function to arrive

hope this helps:

Sub test()

tst = Left(ActiveCell.Text, 19)


Select Case tst

Case "Personal Banking - "
ActiveCell.Interior.ColorIndex = 13 ' Purple'

End Select



End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Wildcards in Excel VBA - HELP

You can't use a wildcard directly in a Select Case; it treats it as a
literal. And it doesn't seem to accept a 'like' clause either - but you can
specify a range and you can do it that way, e.g.
Case "Personal Banking - " To "Personal Banking -Z"

"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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Wildcards in Excel VBA - HELP

Select Case lcase(Left(Somthing,16))
Case "personal banking"

Case "creditor analysi"

End Select


--
Regards,
Tom Ogilvy


"Co-op Bank" wrote in message
...
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



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 in Excel Pai Excel Worksheet Functions 2 January 25th 09 06:52 PM
excel 2003 wildcards quynies_mom Excel Worksheet Functions 2 January 3rd 09 05:45 AM
Excel - Wildcards soke2001 Excel Discussion (Misc queries) 3 September 14th 07 03:22 PM
How can I find strings of wildcards in Excel? Nick M Excel Discussion (Misc queries) 2 December 20th 04 05:59 PM
Excel Searching and Wildcards EuanB Excel Programming 1 October 16th 03 01:21 PM


All times are GMT +1. The time now is 10:33 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"