LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default find problem

Hi
try something like the following:
Sub foo()
Dim firstAddress
Dim FoundCell As Range
Dim search_rng As Range
Set seaarch_rng = Selection
Set FoundCell = search_rng.Find(....)
Dim firstRow
Dim lastRow

If Not FoundCell Is Nothing Then
firstAddress = FoundCell.Address
firstRow = FoundCell.Row
Do
lastRow = FoundCell.Row
Set FoundCell = search_rng.FindNext(FoundCell)
Loop While Not FoundCell Is Nothing And
FoundCell.Address < firstAddress
Else
' Not Found
End If
End Sub


-----Original Message-----
Hi i got some advice from Chip Pearson on Friday on the
find method...

Dim FoundCell As Range
Set FoundCell = Cells.Find(....)
If Not FoundCell Is Nothing Then
' Find was successful, do something with FoundCell
Else
' Not Found
End If

....

This still doesn't seem to work when using it up to 12
times in a loop. is there anything you have to put in in
this situation. I'm sorry if this is very simple, but i
think i do need it spelling out for me. I need to find
the beginning and end of a section of data, see below...


apple
apple
apple
apple
pear
pear
pear
orange
banana
banana
banana

.... and export each section to a different file, which i
can do. I'm sorry to be annoying, but it's on a deadline
and i'm tearing my hair out.
.

 
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
Problem with 'Find' Dave Excel Discussion (Misc queries) 5 December 15th 09 01:27 PM
Find-Replace problem nastech Excel Discussion (Misc queries) 1 February 12th 06 05:18 AM
Find replace problem [email protected] Excel Discussion (Misc queries) 2 December 8th 05 10:30 PM
problem with FIND cjsmith22 Excel Worksheet Functions 3 November 17th 05 11:03 PM
Problem with FIND LSB Excel Programming 2 January 12th 04 04:16 AM


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

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

About Us

"It's about Microsoft Excel"