Select Case - Wildcard or other alternative?

XLML

Active Member
Joined
Aug 15, 2003
Messages
407
I am using Select Case in VBA.
Also, I am working with column B which is TEXT and contains 3 digit numbers formatted as TEXT ie 123, 712, 750, 990

If the value starts with '7', how would I write the code to place the word 'complete' in col J? I tried a wildcard (*) but that didn't put the word in the cell.

Case "7*": Cells(cl.Row, "J") = "COMPLETE"

Thanks in advance,
XLML
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
[code[]]
Case Is >= "700", Is < "800"
[/code]
 
Upvote 0
Thanks for the response NorthWolves but that made everything outside that range, even the blanks say 'complete'. The column that those numbers are in Is Text, I don't know if that makes a difference.

Any advice?
Thanks,
XLML
 
Upvote 0
XLML

This might be one case, pun intended, where case isn't suitable.

Or you need to take a different approach to is use.

For example only using the first character of the cell's value.

Whether or not that's appropriate depends on the other criteria, you've only posted one example - kind of hard to work with.:)
 
Upvote 0
Code:
Select Case Left(testString,1)
    Case Is = "7"
       Cells(cl.Row, "J") = "COMPLETE"
    Case Is = "6"
       Cells(cl.Row, "J") = "almost Complete"
End Select
 
Upvote 0
Thanks for the suggestions Norie and Mike. I ended up using Left to pull the first digit.

Thanks again,
XLML
 
Upvote 0

Forum statistics

Threads
1,214,858
Messages
6,121,956
Members
449,057
Latest member
FreeCricketId

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top