Hi,
Macro will be placed in macro.xlsm & book1.xlsx & Book2.xlsx are located at different place so the path of of both the files should be hardcoded in the macro
If cells in column A of sheet1 of book2.xlsx matches with cells of column A of book1.xlsx then dont do anything & If it doesnt matches then clear all the data in that row of book2.xlsx from column B
(clear all the data in that row of book2.xlsx from column B means from column B till the end of data we have to clear all the data in that unmatched cells in that row,we will not do anything with column A data)
i am currently unable to open your samples, but based on your description
Code:
p1 = "c:\temp\"
p2 = "C:\temp\"
Set wb1 = Workbooks.Open(p1 & "book1.xlsx")
Set wb2 = Workbooks.Open(p2 & "book2.xlsx")
For Each cel In wb2.Sheets(1).Range("a:a")
If IsEmpty(cel) Then Exit For ' stop on empty cell
Set fnd = wb1.Sheets(1).Range("a:a").Find(cel)
If fnd Is Nothing Then cel.Offset(, 1).Resize(, Columns.Count - 1).Clear
Next
i will try to find a machine with a later version of excel, to test
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete