This kind of relates to my post at http://www.excelforum.com/excel-prog...ml#post2003473.
I have 2 worksheets.
Column A on both contains a forename
Column B on both contains a surname.
I have a macro which runs through all the rows on Sheet1 and checks the forename and surname against all the rows in Sheet2. If a match is found, that row is copied onto the same row on Sheet3.
The problem we have is that in 1 sheet a name might be
A B
Tommy Jones
and on the other the same person is in under
A B
Tom Jones
What would the best way be to pick out these irregularities, I.e. still have the code pick the above out as a match and copy the row to Sheet3
Sub checkAssystAgainstEdir()
Dim iAssyst As Long, iEdir As Long, countassyst As Long, countedir As Long
Dim assystfn As String
Dim assystsn As String
Dim edirfn As String
Dim edirsn As String
countassyst = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
countedir = Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
For iAssyst = 2 To countassyst Step 1
assystfn = Cells(iAssyst, 1)
assystsn = Cells(iAssyst, 2)
For iEdir = 2 To countedir Step 1
edirfn = Sheets("Sheet2").Cells(iEdir, 3)
edirsn = Sheets("Sheet2").Cells(iEdir, 2)
If assystfn = edirfn And assystsn = edirsn Then
Exit For
End If
If iEdir = countedir Then
Sheets("Sheet1").Rows(iAssyst).Select
Selection.Copy
Sheets("Sheet3").Rows(iAssyst).Insert
End If
Next
Next
'Tidy up sheet3
DeleteBlankRows ("Sheet3")
End Sub
Any help is greatly appreciated
Bookmarks