shaneleach
asked on
Make VB Case Insensitive
I am trying to alter a macro to make it case insensitive. It is used within an Excel template for a report one of our coders (medical, not computer) uses to post procedures from. I just discovered today that the entity sending the file isn't always consistent in the procedure name (sometimes it's lower case or mixed). How is this accomplished using the attached macro/code? Thanks!!!
Option Explicit
Sub KillRows()
Dim Trange As Range
Dim Row As Range
For Each Row In ActiveSheet.UsedRange.EntireRow.Rows
If Row.Cells(1, "F") = "CT-CA++SCORE" Then
If Trange Is Nothing Then
Set Trange = Row
Else
Set Trange = Union(Trange, Row)
End If
End If
Next Row
If Not Trange Is Nothing Then
Trange.Delete Shift:=xlUp
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Simply use the Format Function:
dim s1 as string
s1 = Format("This is a test", ">")
s1 will be all upper case
do this prior to testing your string data for all opperands and you will get case insensitive compares.
dim s1 as string
s1 = Format("This is a test", ">")
s1 will be all upper case
do this prior to testing your string data for all opperands and you will get case insensitive compares.
In VBA (not VB6) you can put
Option Compare Text
at the top of the code module(s) so that you don't have to convert each string to one particular case.
Option Compare Text
at the top of the code module(s) so that you don't have to convert each string to one particular case.
ASKER