ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   case (https://www.excelbanter.com/excel-programming/397031-case.html)

AlanW

case
 
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




Snake Plissken[_2_]

case
 
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






All times are GMT +1. The time now is 03:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com