more find help please

  • Thread starter Thread starter Gary Keramidas
  • Start date Start date
G

Gary Keramidas

i am looking in a range of cells for non-blank cells. the range has formulas
that may equate to blank, so they're blank, not empty.=IF(J24=0,"",J24)
i was looking for blank cells and this routine worked, but i don't know how to
end the loop.

or, if there is a better way, please let me know

With ws.Range("AS23:AV" & lastrow)
Set rngfound = .Find(What:="", LookIn:=xlValues)
Do
If rngfound Is Nothing Then
Else
MsgBox rngfound.Address ' code goes here
Set rngfound = .FindNext(rngfound)
End If
Next
Loop While
 
Dim strFirstAddress as String

With ws.Range("AS23:AV" & lastrow)
Set rngfound = .Find(What:="", LookIn:=xlValues)
if not rngfound is nothing then
strFirstAddress = rngfound.address
Do
MsgBox rngfound.Address ' code goes here
Set rngfound = .FindNext(rngfound)
Loop Until rngfound.address = strfirstaddress
End if
 
thanks jim.

i found this: strFirstAddress = rngfound.address and used it

but still couldn't get it to work.

i needed this: Loop Until rngfound.address = strfirstaddress

now it works fine.

thanks again
 
jim:

i still have the same problem. i find all of the blank cells, but that's not
what i want. i want all of the other cells. so the code below gives me all of
the a addresses of the blank cells in the do loop, but i need all of the others.
i thought maybe changing

if not rngfound is nothing then
to
if rngfound is nothing then

unless there is a better way to find values in the range that aren't blank

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top