Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gang -
How do I capture the row of a successful Selection.Find? I did find out that Selection.Find returns -1. What's that mean? And how would I do this without making a selection? The macro recorder doesn't help there. I ended up using a "For each cell" loop looking for an equality and incrementing/capturing a counter. Thanks in advance. ....best, Michael |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
rowno = Selection.Find("123").Row
I posted this to a previous posting from you! " wrote: Gang - How do I capture the row of a successful Selection.Find? I did find out that Selection.Find returns -1. What's that mean? And how would I do this without making a selection? The macro recorder doesn't help there. I ended up using a "For each cell" loop looking for an equality and incrementing/capturing a counter. Thanks in advance. ....best, Michael |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
...... by mistake! My fault!
" wrote: Gang - How do I capture the row of a successful Selection.Find? I did find out that Selection.Find returns -1. What's that mean? And how would I do this without making a selection? The macro recorder doesn't help there. I ended up using a "For each cell" loop looking for an equality and incrementing/capturing a counter. Thanks in advance. ....best, Michael |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Using Toppers approach is fine if you are guaranteed that the target value
will be found. If not, it is better to set a reference to the result of the find command and then test if Find was successful Dim rng as Range set rng = Columns("C").Find("123") if not rng is nothing then rw = rng.row Else msgbox "123 not found" exit sub End if -- Regards, Tom Ogilvy wrote in message news:w8rAf.9318$bF.2432@dukeread07... Gang - How do I capture the row of a successful Selection.Find? I did find out that Selection.Find returns -1. What's that mean? And how would I do this without making a selection? The macro recorder doesn't help there. I ended up using a "For each cell" loop looking for an equality and incrementing/capturing a counter. Thanks in advance. ...best, Michael |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom -
Thank you. Toppers message never made it to my news server, but I see the way to go. Thanks again. ....Hash In article , "Tom Ogilvy" wrote: Using Toppers approach is fine if you are guaranteed that the target value will be found. If not, it is better to set a reference to the result of the find command and then test if Find was successful Dim rng as Range set rng = Columns("C").Find("123") if not rng is nothing then rw = rng.row Else msgbox "123 not found" exit sub End if |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I find the series selection tab? | Charts and Charting in Excel | |||
selection.find help! | Excel Programming | |||
Capturing the column number and # of columns in a selection | Excel Programming | |||
Find selection | Excel Programming | |||
Find the row of all cells in a selection | Excel Programming |