Microsoft Office Tutorials and References
In Depth Information
Some Useful Worksheet Functions
LastInRow = “”
LastInRow = .End(xlToLeft).Value
End If
End With
End With
End Function
Does a string match a pattern?
The IsLike function is very simple (but also very useful). This function returns TRUE if a text
string matches a specified pattern.
This function, which follows, is remarkably simple. As you can see, the function is essentially a
wrapper that lets you take advantage of VBA’s powerful Like operator in your formulas.
Function IsLike(text As String, pattern As String) As Boolean
‘ Returns true if the first argument is like the second
IsLike = text Like pattern
End Function
This IsLike function takes two arguments:
h text : A text string or a reference to a cell that contains a text string
h pattern : A string that contains wildcard characters according to the following list:
Character(s) in Pattern
Matches in Text
Any single character
Zero or more characters
Any single digit (0–9)
Any single character in charlist
Any single character not in charlist
The following formula returns TRUE because * matches any number of characters. It returns
TRUE if the first argument is any text that begins with g.
The following formula returns TRUE because ? matches any single character. If the first argument
were “Unit12” , the function would return FALSE .
Search JabSto ::

Custom Search