View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Phillips Phillips is offline
external usenet poster
 
Posts: 48
Default Trying to find a value from one sheet, on another, then compare rows

I am tring to fing an email address from one sheet, on another
("NewMaster".)
email is in col 5
date is in col 10

Than, if the email is found on "NewMaster" compare dates. If the date is
NEWER, than copy the data that is in "NewMaster", to "DUPS", and then
replace the data in "NewMaster" from the excel sheet I am testing from.
If it is OLDER, than copy info to DUPS.
If NOT found, than ADD it to "NewMaster".

I am having problems just FINDING the email.... Here is what I have...

HELP,
Phil


Public Function CompRows(passemail As String) ', ws1 As String, ws2 As
String)
Dim nWS As String
Dim C
Dim successfull_activate
nWS = "NewMaster"
'MsgBox passemail
Windows("Testq.xls").Activate
' MsgBox "Select: " &
Sheets("NewMaster").Select
'
' Windows("Testq.xls").Activate
' Activate nWS
On Error GoTo Err_Handler
'MsgBox "Select: " & Worksheets("NewMaster").Activate
'MsgBox
'Set successfull_activate = Worksheets("NewMaster").Activate
Cells.Select
Set C = Selection.Find(What:=passemail, After:=ActiveCell, LookIn _
:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=
_
xlNext, MatchCase:=False, SearchFormat:=False).Activate
' MsgBox C

'Activate
Cells.Select


' MsgBox Cells.Find(What:=(passemail)).Activate
' MsgBox "value:" & ActiveCell.Value
If ActiveCell.Value = (passemail) Then
'***** Excel found a match
MsgBox "Found"
Else
'****** Excel Didn't find a match,
'****** so move to next sheet or stop searching
MsgBox "Not Found"
End If

Err_Handler:
'Error handling code

Select Case Err.Number
Case 91 '***** Error # when excel Find can't find value in Sheet
Resume Next
Case Else
End Select




End Function