case

G

Guest

Is there any wild card such as * that can be used in Case statement.

I have a VBA statement like

For Each cell In Range("C1")
Select Case cell.Value
Case "ABoy"
cell.Offset(0, 1).Value = 10
Case "A*" <----------------------------i.e. A and all other thing except A
itself
cell.Offset(0, 1).Value = 20
Case Else
cell.Offset(0, 1).Value = 99
End Select
Next

Could someone please show me the right way to do it.

Many Thanks
 
S

Snake Plissken

what about this:

Sub qq()


Dim MyCheck As String

MyCheck = Cells(1, 3).Value

Cells(1, 3).Select

If MyCheck = "ABoy" Then

ActiveCell.Offset(0, 1).Value = 10

ElseIf MyCheck Like "A*" Then

ActiveCell.Offset(0, 1).Value = 20

Else

ActiveCell.Offset(0, 1).Value = 99

End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top