View Single Post
  #24   Report Post  
Posted to microsoft.public.excel.misc
Dave O
 
Posts: n/a
Default Entering a range of numbers and searching same

Try this instead. We should be getting close, now!

Sub FindDoc()
Dim r As Range
Dim j, k, l As Long
Set r = Intersect(ActiveSheet.UsedRange, Columns("d:d"))
j = r.Rows.Count
k = --InputBox("Enter document number:")
Range("r1").Value = k
For l = 1 To j
If k = Cells(l, 4).Value Then
If k <= Cells(l, 5).Value Then
Cells(l, 6).Select
MsgBox ("Document Number " & k & " Client " & Cells(l, 6).Value)
Exit Sub
End If
End If
Next
MsgBox ("Document Number " & k & " not assigned")
End Sub