austenr
04-29-2005, 02:28 PM
How can I fill in an information box with the results from the Search routine. Thank you DRJ for the routine, but I can't seem to get it to work. I am attaching the file for consideration. The data is in a sheet called "DataSheet".
Option Explicit
Public Sub CommandButton1_Click()
Dim Cel As Range
Dim FirstAddress As String
With Range("A:A")
Set Cel = .Find(What:="Test", LookIn:=xlValues, _
LookAt:=xlWhole, MatchCase:=False)
If Not Cel Is Nothing Then
FirstAddress = Cel.Address
Do
MsgBox Cel.Address
Set Cel = .FindNext(Cel)
Loop While Not Cel Is Nothing And Cel.Address <> FirstAddress
End If
End With
End Sub
Option Explicit
Public Sub CommandButton1_Click()
Dim Cel As Range
Dim FirstAddress As String
With Range("A:A")
Set Cel = .Find(What:="Test", LookIn:=xlValues, _
LookAt:=xlWhole, MatchCase:=False)
If Not Cel Is Nothing Then
FirstAddress = Cel.Address
Do
MsgBox Cel.Address
Set Cel = .FindNext(Cel)
Loop While Not Cel Is Nothing And Cel.Address <> FirstAddress
End If
End With
End Sub