PDA

View Full Version : comparing....



popop
12-13-2006, 12:37 AM
dear all,
i have an excel file with two sheets
in sheet 1 i have in column A some values
in sheet 2 in column J some other values
i want with a macro or i dunno in a formula if possible to see the cells in commun and put them
in sheet 3
how can i do that????
thanks in advance...

mdmackillop
12-13-2006, 01:39 AM
Hi Popup,
Welcome to VBAX

Try

Option Explicit
Sub Copies()
Dim cel As Range, c As Range, i As Long
For Each cel In Sheets(1).Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp))
Set c = Sheets(2).Columns(10).Find(cel)
If Not c Is Nothing Then
i = i + 1
Sheets(3).Cells(i, 1) = cel
End If
Next
End Sub