View Single Post
  #5   Report Post  
Posted to microsoft.public.dotnet.framework,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
Ben Voigt Ben Voigt is offline
external usenet poster
 
Posts: 2
Default Help with creating a search engine in excel vba


"Zigball" wrote in message
oups.com...
hello charles again i want to give you my full example so you can
proably understand me a little better.
example:------------------------------------------------------------

Private Sub Add_Click()
Dim r As Range
Dim ws As Worksheet
Dim SearchTxt As String
Set ws = Worksheets("sheet6")
SearchTxt = textbox1.Value
Set r = ws.Cells.Find(What:=SearchTxt, After:=ws.Range("A1"), _
LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=True)
If r Is Nothing Then Exit Sub
textbox1.Value = r.Cells(r, 1)
End Sub


Try
textbox1.Value = r.Item(1,2).Value
which should get you the value right next to the key you found

---------------------------------------------------------------------------------------------------
I want to explain that I have a userform and I want to return the
search into the userform textboxes and comboboxes etc...