Here is the portion of the code that im trying to get working. I want in column B to find all occurences of the same part number. But for some reason it doesnt work. Here is the code. I get an error with it. i just cant figure out WHY!. ANy help would be greatly appreciated
Sub Test1()
Dim ptipn As String
Dim myRange As Range
Dim r1 As Range
Dim r2 As Range
'Dim rc As Range
Dim r3 As Range
Dim Reply As Variant
Start:
ptipn = InputBox("Enter PTI Part number: ", "Lookup Value")
Set r1 = Range("B1").EntireColumn
r1.Name = "PN"
Range("PN").Select
Set r2 = Range("PN").Find(ptipn)
If r2 Is Nothing Then
response = MsgBox("The Part number " & _
ptipn & " was not found. Would you like to try again?", vbQuestion + vbYesNo)
If response = vbYes Then
GoTo Start
ElseIf response = vbNo Then
End
End If
Else
r2.Select
Selection.EntireRow.Select
ActiveCell = r2
Set r3 = ActiveCell
differentvendor:
diffvend = MsgBox("Would you like to find another vendor with the same PTI Part number?", vbQuestion + vbYesNo)
If diffvend = vbYes Then
Do While Not IsEmpty(ActiveCell)
MsgBox r3
Range("PN").FindNext(r3).Select
Selection.EntireRow.Select
'If Range("PN").FindNext(r3) Is Nothing Then
'sorry = MsgBox("Sorry, there are no more vendors for that PTI part number. Restart?", vbQuestion + vbYesNo)
' GoTo restart1
GoTo differentvendor
Loop
Else
restart = MsgBox("Restart??", vbQuestion + vbYesNo)
restart1:
If restart = vbYes Then
GoTo Start
Else: End
End If
End If
End If
End Sub
The error is in the findnext line..how do i find the next occurence of the SAME part number??
Bookmarks