Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default more find help please

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
--


Gary



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default more find help please

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
--
HTH...

Jim Thomlinson


"Gary Keramidas" wrote:

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
--


Gary




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default more find help please

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

--


Gary


"Jim Thomlinson" wrote in message
...
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
--
HTH...

Jim Thomlinson


"Gary Keramidas" wrote:

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
--


Gary






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default more find help please

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
--


Gary


"Jim Thomlinson" wrote in message
...
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
--
HTH...

Jim Thomlinson


"Gary Keramidas" wrote:

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
--


Gary






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default more find help please

i'm just going to use a for each cell statement and evaluate each cell


--


Gary


"Jim Thomlinson" wrote in message
...
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
--
HTH...

Jim Thomlinson


"Gary Keramidas" wrote:

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
--


Gary






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find First Non blank cell than find column header and return that value Silver Rose Excel Worksheet Functions 10 April 30th 07 05:56 PM
Despite data existing in Excel 2002 spreadsheet Find doesn't find AnnieB Excel Discussion (Misc queries) 1 June 16th 06 02:15 AM
find and delete duplicate entries in two columns or find and prin. campare 2 columns of numbers-find unique Excel Programming 1 November 24th 04 04:09 PM
find and delete text, find a 10-digit number and put it in a textbox Paul Excel Programming 3 November 16th 04 04:21 PM
backwards find function to find character in a string of text Ashleigh K. Excel Programming 1 January 14th 04 04:36 PM


All times are GMT +1. The time now is 11:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"