This should do the trick:
Sub snb()
c01 = "|" & LCase(Join(Application.Transpose(Sheets("Malenames").Cells(1).CurrentRegion.Columns(1)), "|")) & "|"
c02 = "|" & LCase(Join(Application.Transpose(Sheets("FeMalenames").Cells(1).CurrentRegion.Columns(1)), "|")) & "|"
c03 = "|" & LCase(Join(Application.Transpose(Sheets("Surnames").Cells(1).CurrentRegion.Columns(1)), "|")) & "|"
sr = Sheets("ImePriimek").Cells(1).CurrentRegion.Resize(, 6)
For j = 2 To UBound(sr)
If InStr(c01, "|" & LCase(sr(j, 2)) & "|") > 0 Then sr(j, 4) = sr(j, 2)
If InStr(c02, "|" & LCase(sr(j, 2)) & "|") > 0 Then sr(j, 5) = sr(j, 2)
If InStr(c01, "|" & LCase(sr(j, 3)) & "|") > 0 Then sr(j, 4) = sr(j, 3)
If InStr(c02, "|" & LCase(sr(j, 3)) & "|") > 0 Then sr(j, 5) = sr(j, 3)
If InStr(c03, "|" & LCase(sr(j, 2)) & "|") > 0 Then sr(j, 6) = sr(j, 2)
If InStr(c03, "|" & LCase(sr(j, 3)) & "|") > 0 Then sr(j, 6) = sr(j, 3)
Next
Sheets("ImePriimek").Cells(1).CurrentRegion.Resize(, 6) = sr
End Sub
If it's a male's name it will be put into column D
If it's a female's name it will be put into column E
If it's a surname it will be put into column F
No need to differentiate any further.
Bookmarks