C
Corey
Can anyone see why the below code results in a MasgBox "Found", even though
there is NO Sheet2.Range("A1").value in Sheet3(SavedData) ?
Sub SaveCoverPage()
' Check to see if the Record Already Exists
Dim rngFound As Range
On Error Resume Next
' Gain the Location of the Cover Page Title
With Worksheets("SavedData").Range("A:A")
Set rngFound = .Find(What:=Sheet2.Range("A1").Value, After:=Cells(1),
LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext,
MatchCase:=True, Matchbyte:=True)
If rngFound.Value <> "" Then ' <==== If there is a Sheet2Range("A1").value
found
MsgBox "Found" '
<----------------------------------------------------------- I ALWAYS get
this result, even if there is NO value in the SavedData sheet matching the
valuer in Sheet 2 A1.
Else ' <===== =============== If there is Not Sheet2.Range("A1").value
found
MsgBox "Not Found"
End If
End With
End Sub
Corey....
there is NO Sheet2.Range("A1").value in Sheet3(SavedData) ?
Sub SaveCoverPage()
' Check to see if the Record Already Exists
Dim rngFound As Range
On Error Resume Next
' Gain the Location of the Cover Page Title
With Worksheets("SavedData").Range("A:A")
Set rngFound = .Find(What:=Sheet2.Range("A1").Value, After:=Cells(1),
LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext,
MatchCase:=True, Matchbyte:=True)
If rngFound.Value <> "" Then ' <==== If there is a Sheet2Range("A1").value
found
MsgBox "Found" '
<----------------------------------------------------------- I ALWAYS get
this result, even if there is NO value in the SavedData sheet matching the
valuer in Sheet 2 A1.
Else ' <===== =============== If there is Not Sheet2.Range("A1").value
found
MsgBox "Not Found"
End If
End With
End Sub
Corey....