Jumat, 20 Januari 2017

Re: [ExcelVBA] Why am I getting #VALUE back from this function?

 

A first total guess would be lose the space from ' Scrape'.


HTH
Lisa


-----Original Message-----
From: solutionbuilder@yahoo.com [ExcelVBA] <ExcelVBA@yahoogroups.com>
To: ExcelVBA <ExcelVBA@yahoogroups.com>
Sent: Fri, Jan 20, 2017 4:19 pm
Subject: [ExcelVBA] Why am I getting #VALUE back from this function?




I am trying to create a very simple function that will take a string of text and read a range of texts to see if I have any that string in any of the ranges of the texts.   Should be a 10-minute problem to solve.   I am however getting a #VALUE back.
I call the function with this:
=Contains(F2,' Scrape'!$D$2:$D$2062)

The function is this: 
Function Contains(ChkFor As String, ChkRng As Range) As String

For Each cell In ChkRng
    If (InStr(cell.Value, ChkFor, 1)) Then
        Contains = "Found"
        Exit For
    End If
    Contains = "Not Found"
Next cell
End Function


OK, I said it was simple :)  However, can anyone point to the problem in this code.   I have looked at it until I have become frustrated.

Thanks, 
Greg



__._,_.___

Posted by: Green <1z@compuserve.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.

----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------

.

__,_._,___

Tidak ada komentar:

Posting Komentar