A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Am 05.01.2011 08:01, schrieb Er. Nitin Pandey:
i am trying to compare cell of a range with array value, both the value ar same but its not showing msg, code is :-
Most errors were made in comparisons:
a.) One of the strings has a trailing space
b.) The spelling of the strings is not the same
Therefore, it is advisable to remove the spaces and use the comparison options:
--- schnipp ---
Option Compare Text
Sub Test()
If Trim$(" Andreas") = Trim$("andreas ") Then _
MsgBox "Strings are equal"
End Sub
--- schnapp ---
or
--- schnipp ---
Sub Test()
If StrComp(Trim$(" Andreas"), Trim$("andreas "), vbTextCompare) = 0 Then _
MsgBox "Strings are equal"
End Sub
--- schnapp ---
Andreas.