Hi,
I have got the following macro which compare column 1 of 2 excel sheets and then copy columns 2 and 3 for the common values present in both sheets. What I should I change in this macro so that I am able to copy more then 2 columns?
Please reply at your earliest!!!
Thanks in advance to all of you!!!
I have got the following macro which compare column 1 of 2 excel sheets and then copy columns 2 and 3 for the common values present in both sheets. What I should I change in this macro so that I am able to copy more then 2 columns?
Code:
Sub test12()
Dim fn As String
fn = "'D:\Documents and Settings\rohit.malik\Desktop\Personal\Copy Macro\[book2.xls]sheet1'!"
With Workbooks("book1.xls").Sheets("sheet1")
With .Range("a1", .Range("a" & Rows.Count).End(xlUp)).Offset(, 1).Resize(, 2)
.Formula = "=vlookup($a1," & fn & "$a:$d,column(b1),false)"
.Value = .Value
End With
End With
End Sub
Please reply at your earliest!!!
Thanks in advance to all of you!!!