Problem with LCase and UCase

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,216
Office Version
  1. 2016
Hi again,

hope you guys are kind to help me with this I can not work out..

Code:
Function TestGMBH(ByVal strText As String) As String
    Dim strSearch As String
    
    strText = LCase(strText)
    
    Select Case True

        Case strText Like "*myword*"
            If strText Like "myword ref*" Then
                TestGMBH = "REF found"
            ElseIf strText Like "*myword iban*" Then
                TestGMBH = "IBAN found"
            ElseIf strText Like "myword ####*" Then
                TestGMBH = "myword with Numbers found"
            
                
            End If
            
        Case Else
        End Select
                
End Function

this is a little test function I am trying to work it out..

However the myword is only a substring within strText the function is also larger and findes different words ans soforth..

So my issue is that myword could be wrinten in the text like MyWord or MYWORD and few more...
How can I make myword non case sensitive with the SELECT CASE statement?

Much appreciated as always .-)
 
Last edited:

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Try to put the below line in the top of your module. Though be aware that everything will NOT be case sensitive

Code:
Option Compare Text
 
Upvote 0
Hi guys!

Sorry was busy so had no time to look into this again.
I will try that thanks for your help!

But there is another one on the way gg
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

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