Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi
new to this I have a spreadsheet with 2 columns of alpha/numetic numbers. I need to identify which numbers are in both columns and what cell they are in. there are approx 3000-4000 lines. Is anyone able to tell me how to search the columns to find the answer.Many thanks in advance
Annette

Let's say one set of values is in A1:A4000 and you want to compare them to the values in B1:B4000. This code will search Column B for each value in Column A and if it finds it in Column B, it will put the value in Column C, the address from Column A in Column D and the address from Column B in Column E. The results will be placed starting in C1 and continue in C2, C3 etc.
Note: If the same value occurs more than once in column A and in B, it will return all the column A addresses, but keep repeating the first Column B address. That can be fixed with a little more code, but I need to know if that will be an issue. The code will also ignore blank cells in Column A.
Sub Locate_Dup_Addresses()
For Each cell In Range("A1:A4000")
If cell <> "" Then
With Range("B1:B4000")
Set c = .Find(cell, lookat:=xlWhole)
If Not c Is Nothing Then
NewRow = NewRow + 1
Cells(NewRow, "C") = c
Cells(NewRow, "D") = cell.Address
Cells(NewRow, "E") = c.Address
End If
End With
End If
Next
End Sub

![]() |
Print window delay in wo...
|
word 2003 wont open certa...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |