各位大大好:
[attach]17747[/attach]
小弟有A、B二欄的文字字串,
也先利用 TRIM來取出字串比對,
但還是無法成功比對。不知應如何
可逹成比對文字呢?
語法如下:
Sub aa()
Dim mSht1 As Worksheet
Dim mRng As Range, mRng1 As Range
Dim mStr1$, mStr2$
Set mSht1 = Worksheets(1)
With mSht1
Set mRng1 = .Range("a2", .Range("a" & .Rows.Count).End(xlUp))
For Each mRng In mRng1
mStr1 = Trim(mRng.Value)
mStr2 = Trim(mRng.Offset(, 1))
mRng.Offset(, 2) = IIf(StrComp(mStr1, mStr2, vbTextCompare) = 0, "TRUE", "FALSE")
Next
End With
End Sub