LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default Need help utilizing the "Like" function

Dreiding -

I am not sure why you aren't using Excel's functions, but here is why your's
isn't working.

You are only testing for the last character to be 0-9. The asterisk will
match to zero or more characters. For example,
Like "*6"
will match for all of these:
abc6
126
6
Z6

That means Like "*[0-9]" will match to any character string ending in a
numeric digit.

If you have a fixed-length string of length 4 and you want them all numeric,
then you could use this:
Like "[0-9][0-9][0-9][0-9]"

If it is variable-length, then you could loop through each character to test
for numerics.

--
Daryl S


"Dreiding" wrote:

Using Excel 2003, here is example code that doesn't work. What am I doing
wrong?
My isNumeric test returns "True", but there an "A" in my string.
Am I not checking for all the character to be 0 - 9?

Sub Test1()
Debug.Print isNumeric("A00101")
End Sub

Function isNumeric(ByVal sInput As String) As Boolean
If sInput Like "*[0-9]" Then
isNumeric = True
Else
isNumeric = False
End If
End Function

Thanks,
- Pat

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text "comparison" operator for "contains" used in an "IF" Function Pawaso Excel Worksheet Functions 4 April 4th 23 11:35 AM
Excel 2003: Conditional Formatting using "MIN" & "MAX" function MMangen Excel Discussion (Misc queries) 2 September 16th 08 07:13 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
function to return day in the form "Monday", "Tuesday" etc given . MTro Excel Worksheet Functions 2 October 3rd 07 09:49 AM
Please add a "sheet" function like "row" and "column" functions Spreadsheet Monkey Excel Programming 2 November 8th 05 04:08 PM


All times are GMT +1. The time now is 09:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"