Fast string comparison
Hi Robert,
Am Sun, 17 May 2015 01:22:48 -0700 schrieb Robert Crandal:
Claus, do you think it will be faster to use the "<" or "" operators
to compare strings?
I don't have much experience working with text in Excel. But you are
right. You don't have to compare sign for sign, you can compare the
whole string.
Try:
Option Explicit
Option Compare Text
Sub StringCompare()
Dim StrA As String, strB As String
StrA = "left-handed"
strB = "right-handed"
If StrA < strB Then
MsgBox "True"
Else
MsgBox "False"
End If
End Sub
If you use
Option compare Binary
"AAA"< "aaa"
With Option Compare Text both are equal
Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
|