View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Find and display rows with criteria

Sub billy()
Dim r As Range
v = Application.InputBox("Enter value: ", Type:=1)

For Each r In ActiveSheet.UsedRange
If r.Value = v Then
MsgBox (r.Address)
End If
Next
End Sub

The user enters a number and the sub displays all the records (addresses)
that contain that number.
--
Gary''s Student


"Billy B" wrote:

I need some help writing a macro that would prompt the user for a value,
search the active worksheet and display all records that contain the value
input in the inputbox.

Thank you for your help.