Ricardo Caicedo
New Member
- Joined
- Aug 21, 2014
- Messages
- 43
Hello again </SPAN>
I am having problems trying to convert a string variable inside a user defined function to lower case. The function pass two string variables (word & Name) and I assign them to a temp variable. The StrComp() function is not compiling, it give me a error …Any Help….</SPAN>
Function WordMatch(Word, Name)</SPAN>
Dim i As Integer</SPAN>
Dim NumWords As Integer</SPAN>
Dim StrTrim As String, StrAux As String, StrWLow As String, StrNLow As String</SPAN>
'Count the words inside the cell</SPAN>
StrTrim = WorksheetFunction.Trim(Word) 'Trim spaces from Word</SPAN>
StrAux = WorksheetFunction.Substitute(StrTrim, " ", "") 'Substitute spaces for nothing</SPAN>
NumWords = Len(StrTrim) - Len(StrAux) + 1 'Number spaces plus one is the number of words</SPAN>
StrWLow = StrConv(Word, VbStrConv.LowerCase)</SPAN></SPAN>
StrNLow = StrConv(Name, VbStrConv.LowerCase)</SPAN></SPAN>
If NumWords = 1 Then</SPAN>
If StrComp(StrWLow, StrNLow, vbTextCompare) Then</SPAN>
WordMatch(Word, Name) = "True"</SPAN>
End If</SPAN>
End If</SPAN>
End Function</SPAN>
I am having problems trying to convert a string variable inside a user defined function to lower case. The function pass two string variables (word & Name) and I assign them to a temp variable. The StrComp() function is not compiling, it give me a error …Any Help….</SPAN>
Function WordMatch(Word, Name)</SPAN>
Dim i As Integer</SPAN>
Dim NumWords As Integer</SPAN>
Dim StrTrim As String, StrAux As String, StrWLow As String, StrNLow As String</SPAN>
'Count the words inside the cell</SPAN>
StrTrim = WorksheetFunction.Trim(Word) 'Trim spaces from Word</SPAN>
StrAux = WorksheetFunction.Substitute(StrTrim, " ", "") 'Substitute spaces for nothing</SPAN>
NumWords = Len(StrTrim) - Len(StrAux) + 1 'Number spaces plus one is the number of words</SPAN>
StrWLow = StrConv(Word, VbStrConv.LowerCase)</SPAN></SPAN>
StrNLow = StrConv(Name, VbStrConv.LowerCase)</SPAN></SPAN>
If NumWords = 1 Then</SPAN>
If StrComp(StrWLow, StrNLow, vbTextCompare) Then</SPAN>
WordMatch(Word, Name) = "True"</SPAN>
End If</SPAN>
End If</SPAN>
End Function</SPAN>