Hi all,
i tried ask on other forum in this thread
http://www.vbaexpress.com/forum/showthread.php?t=28628
but there nobody helps me with this (with other CODES helps me a lot), so i try it here.
Pls. how can i define, that i want after pressing enter in textbox1 in sheet1 search name from sheet2. After pressing enter it will continue in search. The first founded value write to sheet1 in cell J2. The next value after next enter write it also in J2 and other enter ....
thx a lot
this is my try which doesnt works... 
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim i As Long
' Dim cell As Range
Static cell As Range
Dim FirstCell As String
Dim rSrch As Range
Static rCl As Range
Dim fnd As String
Dim meno As String
Dim FirstAddress As String
If TextBox1.Value = "" Then Exit Sub
If KeyCode = 13 Then
meno = Range("j2").Value
fnd = Me.TextBox1.Value
With Worksheets("2008")
With .Range(.Range("e1"), .Range("e65536").End(xlUp))
' Set rSrch = Range.Worksheet("2008")(Range("e1"), Range("e65536").End(xlUp))
Set rSrch = Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp))
If rCl Is Nothing Then
Set rCl = rSrch.Cells(1, 1)
Else
Set rCl = rCl.Offset(1, 0)
If Application.Intersect(rCl, rSrch) Is Nothing Then Set rCl = rSrch.Cells(1, 1)
End If
With rSrch
Set rCl = .Find(fnd, After:=rCl, LookIn:=xlValues)
If Not rCl Is Nothing Then
FirstAddress = rCl.Address
Cells(Rows.Count, 3).End(xlUp).Offset(0, 0).Value = rCl.Value
If rCl.Value = meno Then
Set rCl = .FindNext(rCl)
Cells(Rows.Count, 3).End(xlUp).Offset(0, 0).Value = rCl.Value
End If
Else
MsgBox "Not found"
Set rCl = Nothing
End If
End With
End With
End With
End If
end sub
Bookmarks