Hi,
The first FIND operation looks for a string in sheet 1, and the second FIND operation which is within the DO-While loop of the first FIND looks for a string in sheet 2.
When I try to run this code, it doesn't seem to work. It fails on the line with '*****. Is it because I switch back and forth between sheet 1 and sheet 2?
Thank you for your help.
Here's a snippet of my code.
firstSheet.Activate
firstSheet.Range("D1"
.Select
With firstSheet.Range("D
"
Set rFind = .Find(What:=sFirstSearch, After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
If Not rFind Is Nothing Then
Do
firstAddress = rFind.Address
''''''''
secondSheet.Activate
'Do Second FIND in secondSheet
''''''''
firstSheet.Activate
Set rFind = .FindNext(rFind) '*****
Loop While Not rFind Is Nothing And rFind.Address <> firstAddress
End If
End with
The first FIND operation looks for a string in sheet 1, and the second FIND operation which is within the DO-While loop of the first FIND looks for a string in sheet 2.
When I try to run this code, it doesn't seem to work. It fails on the line with '*****. Is it because I switch back and forth between sheet 1 and sheet 2?
Thank you for your help.
Here's a snippet of my code.
firstSheet.Activate
firstSheet.Range("D1"

With firstSheet.Range("D


Set rFind = .Find(What:=sFirstSearch, After:=ActiveCell, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
If Not rFind Is Nothing Then
Do
firstAddress = rFind.Address
''''''''
secondSheet.Activate
'Do Second FIND in secondSheet
''''''''
firstSheet.Activate
Set rFind = .FindNext(rFind) '*****
Loop While Not rFind Is Nothing And rFind.Address <> firstAddress
End If
End with