Using Input Bx to Find Record
I got this code to work and find a record in a range of data and select that
row. But it only finds numbers. I need it to find a string, or a letter-
number combination. What do I need to change?
Private Sub CommandButton6_Click()
ActiveSheet.Unprotect
Dim rngOrder As Range
Dim lngReferenceNumber As Long
lngReferenceNumber = Application.InputBox( _
Prompt:="Enter P.O. Number", _
Title:="Enter P.O. Number", _
Type:=1)
Set rngOrder = Worksheets("PO's").Range("A:A").Find( _
what:=lngReferenceNumber, _
lookat:=xlWhole)
If rngOrder Is Nothing Then
MsgBox "P.O. not found"
ActiveSheet.Protect
Else
With rngOrder
.Activate
Selection.Offset(0, 1).Select
End With
End If
End Sub
|