View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Can I use "or" in a select case construct?

Select Case Left(InitialFilterValue, 2)
Case "<", "<="
GoTo MakeStringPrefixDoubleLeft
Case Else
GoTo MakeStringPrefixSingleLeft
End Select


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"broro183" wrote in
message ...

Hi all,

As part of a larger macro which performs custom autofiltering using a
shortcut key I am trying to use an "Or" operator in one of my "case is"
lines.

Currently I have the following code which is used after identifying
that the left character of the "InitialFilterValue" (dimmed as a string
& sourced from an input box) is "<".

Select Case Left(InitialFilterValue, 2)
Case Is = "<"
GoTo MakeStringPrefixDoubleLeft
Case Is = "<="
GoTo MakeStringPrefixDoubleLeft
Case Else
GoTo MakeStringPrefixSingleLeft
End Select

In the interests of optimising my code & because the first two cases
have the same action, is it possible to combine the first two cases
using something like...
" Case is = "<" Or "<=" "?

FYI, when I try the above line I get the error message "Run time error:
13 type mismatch". I've dimmed InitialFilterValue as a string because
there will be other situations when I am attempting to filter text
strings.


Also in the interests of optimising my complete code is anyone
interested in reviewing it & making suggestions?

btw, it is not as complete as Ron DeBruin's "easy filter"
http://www.rondebruin.nl/easyfilter.htm
but it is quick & effective (apart from dates, which can still
sometimes cause issues) wrt what I need - a keyboard activated custom
filter.

I'll try any suggestions when I get a chance in the morning,
Thanks in advance,

Rob Brockett
NZ
Always learning & the best way to learn is to experience...


--
broro183
------------------------------------------------------------------------
broro183's Profile:

http://www.excelforum.com/member.php...o&userid=30068
View this thread: http://www.excelforum.com/showthread...hreadid=519094