View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
fred fred is offline
external usenet poster
 
Posts: 21
Default Excel automation: how to employ Find function?

OK.
I have 2 sheets: Sheet1 and Sheet2.
After selecting (making active) one cell in Sheet2 I need to do fast
comparision (or find?) to check whether the same value exists on Sheet1.
That is all.
And I am interested in to check only the data contained in one selected
column.in Sheet1.
Thanks,
Fred

"Rick Rothstein" wrote in message
...
Your previous post said you were trying to duplicate the speed of the
Edit/Find menu option, but then this posting seems to indicate you are
trying to find duplicates. This seems to contradict what you said in your
other post (or at least I'm not clear on what you are doing)... forget the
timer (you shouldn't be using Find by looping cell by cell the way you
have your loop set up)... can you just tell us what you want your function
to ultimately do (find the first address for the cell with 2340553 in it,
or maybe find the address for the second cell with 2340553 in it, or
simply find that there is more than one cell with 2340553 in it, or
something else)?

--
Rick (MVP - Excel)


"fred" wrote in message
...
To add:
I need only to check whether the same data already exists.
Fred

"KC" wrote in message
...
It appears you already found "2340553" in the set statement. Then you
loop through every cell in usedrange to display the time taken.

Am I missing something please?

"fred" wrote in message
...
I do not use vba but visual basic.
I have already created code to search for data, but it is not
instanenous.!
It takes over 20 secs to find the data.
Is that normal?
Below is the code:
==============
Dim c As Range
With moExcelWS.UsedRange
Set c = .Find("2340553")
Start = Timer
For Each c In moExcelWS.UsedRange
If c = "2340553" Then
Debug.Print CStr(Timer - Start)
End If
Next
End With
==============

How can I speed that process? I need to look only in one, preselected
column.
Thanks,
Fred

"JLGWhiz" wrote in message
...
VBA has its own Find method. See the VBA help file.


"fred" wrote in message
...
Hello,
My app written in vbasic uses Excel automation.
How to implement Find function?
I need to check if the same data exists in specified column.
Using Object Browser I've found this:

Function Find(Arg1 As String, Arg2 As String, [Arg3]) As Double
Member of Excel.WorksheetFunction
but that appears to be not part of Excel automation.

Please advise,
Fred