PDA

View Full Version : [SOLVED] Fill in data from Search routine



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

Zack Barresse
04-29-2005, 02:59 PM
Austen, after this line ...


Set Cel = .FindNext(Cel)

.. you can use the Cel object as the cell to adjust. If your message box is trying to get the address, you need one before your Do/Loop and one after the above posted line. Is this what you mean?

P.s. Please keep all threads related to one another together. This should have gone into the other thread (but it's ok :) ).

austenr
04-30-2005, 08:18 AM
No the message box does not come up at all. Maybe I am missing something here...