Thread
:
Find next cell that contains
View Single Post
#
10
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
Find next cell that contains
It appears that you did NOT use all of the example. Be advised that if your
v is in row 3 and you are looking from row1 to 500, you will also fine your
V
Sub SEARCHNEXT()
Dim v
v = Range("a3").Value
With Range("a1:z500")
Set c = .Find(What:=v, After:=ActiveCell, _
LookIn:=xlValues, LookAt:=xlPart, _
SearchOrder:=xlByrows, SearchDirection:=xlNext, _
MatchCase:=False)
If Not c Is Nothing Then
firstAddress = c.Address
Do
MsgBox c.Row
'the rest of your code here
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com wrote in message
...
Yes, thanks, I did. But I'm not proficient enough with the code to take it
to
the next level.
This is what I currently have for 'FINDNEXT':
Sub SEARCHNEXT()
Dim v
v = Range("A3").Value
With Worksheets(1).Range("a1:z500")
Set c = .Find(v, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
End If
End With
End Sub
--
FirstVette52
"Don Guillett" wrote:
Did you look for FINDNEXT as I suggested
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com wrote in message
...
Been there, done that, and I was able to put together code for the
initial
'Find', but what I am wanting to do is use a single piece of code to
find
the
first value, and then continue (on the next button click) to find the
next
value, and the next, ...
Thx!
--
FirstVette52
"Don Guillett" wrote:
Look in the vba help index for FIND and FINDNEXT
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my
ISP
E-mail provider is) netzero.com wrote in message
...
I need to put a search box on a spreadsheet that allows the user to
type
in
values and click a button to search for the next cell that contains
whatever
is entered, in part or in whole, whether at the beginning, middle,
or
end,
and is not case sensitive.
The 'box' is cell A3 and the range to be searched is any cells that
contain
values (numbers or text). I'm just getting rolling with VBA so I'm
not
too
good with coding or modifying these macros. But the macro in this
case
will
be tied to a button beside the cell.
The goal is to have the look and feel of a Web Search tool that
won't
glitch
when the user enters junk.
Thanks in advance for any help!
--
FirstVette52
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett