for i
for j
for k
for l
if cells(i,j)=cells(k,l) then
m=m+1
cells(m,1)=cells(k,l)
end if
next
next
next
next

できました!