Hi,
Below is the code for that:
Copy this code and paste in to one module.
And change the workbooks path.
Sub Test()
Dim WBMain As Workbook
Dim WBSub As Workbook
Dim WSMain As Worksheet
Dim WSSub As Worksheet
Dim index As Long
Dim strSearch As String
'Open main workbook
Set WBMain = Application.Workbooks.Open("C:\X.xls")
'Open sub workbook
Set WBSub = Application.Workbooks.Open("C:\Y.xls")
Set WSMain = WBMain.Sheets(1)
Set WSSub = WBSub.Sheets(1)
'Read each row from main workbook
'And search that string in to second workbook
With WSMain
For index = 1 To .UsedRange.Rows.Count
strSearch = .Cells(index, "A")
'Find is exists
If IsExists(strSearch, WSSub) Then
'Write the code what you want, if the value is exists
End If
Next index
End With
End Sub
Function IsExists(strSearch As String, Ws As Worksheet) As Boolean
Dim rngFind As Range
With Ws
Set rngFind = .Range("A:A").Find(what:=strSearch, LookIn:=xlValues, lookat:=xlPart, searchdirection:=xlNext, searchorder:=xlByRows)
If Not rngFind Is Nothing Then
IsExists = True
Else
IsExists = False
End If
End With
End Function
Hope it will more help you!!!
Regards,
Bookmarks