View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Wildcards in a case statement

typo!!

Elseif Left$(s,1) + "C" then


should of course read

Elseif Left$(s,1) = "C" then


Peter T


"Peter T" <peter_t@discussions wrote in message
...
In theory you could do something like this

Select case True
Case Left$(Cells(x, 9), 1) = "C"
' other Case's must evaluate to a boolean


However for your two conditions simply use If...ElseIf

s = Ucase(Cells(x,9)) ' assuming case insensitive
If s = "BQ" then

Elseif Left$(s,1) + "C" then

ElseIf blah then

End If

Regards,
Peter T


"DG" wrote in message
...
I have a column that contains a 2 character code. How can I use only one
case statement to be true for all cases where the cell started with a C?
For example the cell could contain CA, CD, CQ, C5 etc.

Select Case Cells(x,9)
Case "BQ"
Rejected = False
Case "C*"
Rejected = True
End Select

Dan