Я не уверен на 100%, для чего предназначен весь ваш код. Я надеюсь, что код ниже отражает то, что вы ожидаете довольно близко.
Вам придется изменить названия листов, которые я использовал, и, возможно, изменить последний бит?
Public Sub FindIt()
Dim xForms As Long
Dim rSearch As Range
Dim rFound As Range
Dim sFirstAdd As String
Dim rCopyRange As Range
Dim xTitleID As String: xTitleID = "Title for InputBox"
xForms = Application.InputBox("Enter Barcode", xTitleID, "", Type:=1)
'Only continue if a number > 0 was entered in xForms.
'Pressing Cancel sets xForms to 0.
If xForms <> 0 Then
'ThisWorkbook is the file containing this code.
With ThisWorkbook.Worksheets("Sheet3")
Set rSearch = .Range(.Cells(1, 2), .Cells(.Rows.Count, 2).End(xlUp)) 'Row B1:B500 in your code.
End With
'Look for the first occurrence.
Set rFound = rSearch.Find(xForms, rSearch.Cells(1, 1), xlValues, xlWhole, , xlNext)
If Not rFound Is Nothing Then
Set rCopyRange = rFound
sFirstAdd = rFound.Address
'If a value was found then search for others.
'Stop when the search wraps back to the top again.
Do
Set rFound = rSearch.FindNext(rFound)
Set rCopyRange = Union(rCopyRange, rFound) 'Create a range from all the found values.
Loop While rFound.Address <> sFirstAdd
'Copy the found rows to the "Bar Codes" sheet.
With ThisWorkbook.Worksheets("Bar Codes")
rCopyRange.EntireRow.Copy Destination:=.Cells(.Rows.Count, 1).End(xlUp)
End With
End If
End If
End Sub