View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Rick S. Rick S. is offline
external usenet poster
 
Posts: 213
Default Cells.Find: Why can't I pass a variable?

That addin is exactly what I was attempting to do in my project! I searched
many words looking for possible examples or code to use and just did not find
FlexFind, nor did I know to search for "flex".

Thanks for the link to the addin Dave!!!
And thanks to Jan Karel Pieterse's "FlexFind" for saving my sanity!

--
Regards

Rick
XP Pro
Office 2007



"Dave Peterson" wrote:

Each time you click the button, excel starts the routine from scratch. So it's
always going to find that same cell as the first occurance.

I'm not sure what Find dialog box you're writing about, though.

You may want to try Jan Karel Pieterse's FlexFind to see how he approached it:
http://www.oaltd.co.uk/MVP/

ps. I'd still specify all the .find arguments. These arguments are shared
between the code and the user interface. And you may be relying on an argument
that really isn't what you expected.

Rick S. wrote:

This is maddening, maddening I tell you!
At first the code worked fine, now it doesn€„¢t? The Find Dialog box will not
open!? As long as the Find dialog box is not open it will not iterate thru
worksheets.
Code tested in native form from Jim Thomlinson's reply.

Here is my complete code: (still testing and writing)
===================Activate User Form
Sub FindIt()
SearchWorkBook.Show
End Sub
===================Do some work
Sub CommandButton1_Click()
Dim ws As Worksheet
Dim sFindMe As String
Dim rngFound As Range

sFindMe = TextBox1.Value
For Each ws In ActiveWorkbook.Worksheets
Set rngFound = ws.Cells.Find(What:=sFindMe, _
LookIn:=xlValues, _
LookAt:=xlPart, _
MatchCase:=False)
If Not rngFound Is Nothing Then
ws.Select
rngFound.Select
Exit For
End If
Next ws
End Sub

Sub CommandButton2_Click()
Unload Me
End Sub
====================
Did I change something I don't see? I was adding code to report found data
and Excel crashed, since then the macro quit working as it only finds a
single instance of the search text on a single sheet. Continued clicking of
the Command1 button (OK) does nothing more than what appears to refresh the
screen.

--
Regards

Rick
XP Pro
Office 2007


--

Dave Peterson