View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dewey Dewey is offline
external usenet poster
 
Posts: 16
Default Help with FindNext Method

I have the following code which is searching through a coloumn of data
looking for a number when it finds it, it crosses checks it with a date
if its the one i'm looking for I store it and continue searching for
the next entry. but it doesn't appear to find any values, when I step
through the code rFound = 'Nothing' and I can't work out why. any help
would be great.

Thanks

Dwight


'Find the all occurances of Notional
Dim rFound As Range
Dim sFirstAddress As String

'Set search range to column

Set rFound = ActiveSheet.Columns(Not_Col).Find(Notional)
'If Notional was found
If Not rFound Is Nothing Then
'Store the address in a variable
sFirstAddress = rFound.Address
'Start a loop
Do
row_temp = rFound.Row
Cust_M_Dt = ActiveSheet.Cells(row_temp, M_Dat_Col).Value

If M_Date = Cust_M_Date Then
If flag = 0 Then
Swp_Rw_1 = row_temp
flag = 1
End If

If flag = 1 Then
Swp_Rw_2 = row_temp
flag = 2
End If
End If

'Find the next cell with Notional
Set rFound = ActiveSheet.Columns(Not_Col).FindNext(rFound)
'Stop when Find loops back to the first cell found
Loop Until rFound.Address = sFirstAddress
End If