This ought to work, but I haven't tested it.
Note the added line.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
Sub cbSearch()
Dim Searchvar As String
Dim i As Long
Dim y As Long
Dim x As String
Dim st As String
Searchvar = InputBox("Enter the Lastname to find")
Searchvar = Trim$(Searchvar) ' removes surplus spaces
For i = 5 To 1500
x = Cells(i, 1).Value
y = Cells(i, 1).Row
If Cells(i, 1).Value = Searchvar Then
MsgBox ("Found it! Its ") & Cells(i, 1).Value & _
(" at row") & Str(y)
Cells(y, 1).Activate
st = Selection.Address
MsgBox st
UserForm1.TextBox1.Tag = CStr(y) '<<< Line added
UserForm1.Show
' GoTo Recfixed
End If
If Cells(i, 1).Value = "" Then
End If
Next
Recfixed:
End Sub
'---------
Private Sub UserForm_Initialize()
Dim y As Long
Dim i As Long
Dim x As String
Dim st As String
Dim lastrow As Range
ActiveWorkbook.Sheets(1).Activate
st = Selection.Address
y = CLng(Me.TextBox1.Tag) '<<<
Set lastrow = Cells(y, 1)
TextBox1.Text = lastrow.Offset(, 9).Value
Textbox2.Text = lastrow.Offset(, 10).Value
Textbox3.Text = lastrow.Offset(, 11).Value
Textbox4.Text = lastrow.Offset(, 12).Value
Textbox5.Text = lastrow.Offset(, 13).Value
Textbox6.Text = lastrow.Offset(, 14).Value
End Sub
'------------
"Jim Cone"
wrote in message
y does not have a value in ...
Set lastrow = Cells(y, 1)
--
Jim Cone
San Francisco, USA
(top posting is preferred)
http://www.officeletter.com/blink/specialsort.html