search 2 Columns Please
Sub FindPart()
Dim res, saddr as String
Dim RgToSearch As Range, RgFound As Range
Set RgToSearch = ActiveSheet.Range("C:C")
res = Application.InputBox("Type School Number", _
"Find School", , , , , , 2)
If res = "False" Then Exit Sub 'exit if Cancel is clicked
res = Trim(UCase(res))
If res = "" Then Exit Sub 'exit if no entry and OK is clicked
Set RgFound = RgToSearch.Find(what:=res, _
LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
If RgFound Is Nothing Then
MsgBox "School " & res & " not found."
exit Sub
Else
sAddr = RgFound.Address
do
if rgFound.Offset(0,1).Text = "3.30" then
Application.Goto Reference:= _
RgFound.Offset(0, -1).Address(True, True, xlR1C1)
exit do
set rgFound = RgToSearch.FindNext(rgFound)
Loop while rgFound < sAddr
End If
if rgFound.Offst(0,1).Text < "3.30" then
msgbox " School found, but not 3.30"
End if
End Sub
--
Regards,
Tom Ogilvy
|