chris,
Try the code below.
HTH,
Bernie
MS Excel MVP
Sub TestCompare()
Dim Str1 As String
Dim Str2 As String
Str1 = "act"
Str2 = "cat"
If CompareWords(Str1, Str2) Then
MsgBox "They're the same"
Else
MsgBox "They're different"
End If
End Sub
Function CompareWords(Str1 As String, Str2 As String) As Boolean
CompareWords = (Sorter(Str1) = Sorter(Str2))
End Function
Function Sorter(InWord) As String
Dim myLetters() As String
Dim myLen As Integer
myLen = Len(InWord)
ReDim myLetters(1 To myLen)
Sorter = ""
For i = 1 To myLen
myLetters(i) = Mid(InWord, i, 1)
For j = 1 To i
If myLetters(i) > myLetters(j) Then
Temp = myLetters(i)
myLetters(i) = myLetters(j)
myLetters(j) = Temp
End If
Next j
Next i
For i = 1 To myLen
Sorter = myLetters(i) & Sorter
Next i
End Function
chris said:
I am looking to see if there is a quick and dirty function to compare Two
strings with all the same characters but different order of charactrers. I
don't think i can resort to a simple ascii value because the numerical value
of two different strings might add up to the same value.