hi
Here are a couple of changes which make your code slightly more efficient & may help:
'use a With clause at the start eg
With Worksheets("sheet5")
.Visible = True
Application.Goto Reference:=.Range("a1")
End With
'Change
Dim FindR As Variant
'to
Dim FindR As range
'and change
FindR = Cells.Find(What:=UserForm1.TextBox13.Text, After:=ActiveCell, LookIn:=xlValues, lookat:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True).Activate
'to read
set FindR = Cells.Find(What:=UserForm1.TextBox13.Text, After:=ActiveCell, LookIn:=xlValues, lookat:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True)
'once this is done you can change
TextBox12.Value = ActiveCell.Offset(0, 1).Value
' & ...
'to read
with FindR
TextBox12.Value = .Offset(0, 1).Value
'& ...
end with
'also your first post doesn't show the end of the sub & I assume that it
'actually states
end if
end sub
The above may help but I think the main issue is your use of "Findnext"...
Cells.FindNext(After:=ActiveCell).Activate
The Excel 2003 Help Files state
Continues a search that was begun with the Find method. Finds the next cell that matches those same conditions and returns a Range object that represents that cell.
I think that you/the code has some unknown effect (to me & you, anyway) of clearing an existing Search. Can you delete this line of code completely & just rely on the "Cells.find..." line of code?
hth
Rob
Bookmarks