Thread: find
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default find

Sorry, you are right, that won't work. Here is an alternative (which should
work)

Dim iRow As Long

On Error Resume Next
iRow = ActiveSheet.Evaluate("Match(1, (""" & TextBox1.Text &
"""=A1:A1000)*(""" & _
TextBox2.Text & """=B1:B1000), 0)")
On Error GoTo 0
If iRow 0 Then
'iRow now points to the matching row in the worksheet

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Bob Phillips" wrote in message
...
Use something like this

On Error Resume Next
iRow = Application.Match(1,(TextBox1.Text = Columns(1))*(TextBox2.Text

=
Columns(2)),0)
On Error Goto 0
If iRow 0 Then
'iRow now points to the matching row in the worksheet

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"enyaw" wrote in message
...
I have a userform with two textboxes on it. I use it to find and return
values. How would i code this userform so as if i search the worksheet

for
both values that it will return the values in that row? I need the first
textbox to search through column A and the second textbox to search

through
column B. Both values must be found in the same row. I then need to

return
the values from that row into another form. I have the code to return

the
values.