![Quote](https://www.excelforum.com/images/misc/quote_icon.png)
Originally Posted by
Cheeky Charlie
Fixing this might be quicker than starting from scratch - perhaps you could post it (don't forget code tags).
HTH
Ok, actually the first textbox is actually a combobox (sometimes I dont have to type the whole part# because of the rowsource) "cbo1"
The original code would search a column on multiple sheets. I want it to stay on the same sheet (Adjust1!).
Private Sub Userform_Initialize()
With cbo1
cbo1.RowSource = "Adjust1!B5:B517"
End With
cbo1.Value = ""
End Sub
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim sh As Worksheet
Dim rng As Range
Dim sStr As String
Dim ans As Variant
sStr = cbo1.Value
For Each sh In ActiveWorkbook.Worksheets
Set rng = sh.Cells.Find(What:=sStr, _
After:=sh.Range("B1"), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
firstAddress = rng.Address
Application.Goto rng, True
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rng.Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(0, 1).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = TextBox1.Value
cbo1.Value = ""
TextBox1.Value = ""
Exit Sub
End If
Next
End Sub
Bookmarks