Using the Find function

Nansmico

New Member
Joined
Jul 24, 2021
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
I have a column with 10 serial numbers I want to find within another column of hundreds of serial numbers. I want a macro to be able to sequentially read each of the 10 numbers and give me the cell address of a match from the large list.

When using the Find function, is it possible to point to a cell that contains the search string?

for example:

Range("A1:A1000").Find(cell address of the serial number I'm looking for)

I hope my question is clear, I'm new to VBA

Dim foundSerial as Range
Dim i as Integer

i = 1
For Each cell In Range("B1:B10") ' Serial numbers to look for in column A
Set foundSerial = Range("A1:A1000").Find( cell address of the serial number I'm looking for +i)

If foundSerial Is Nothing Then
Cells(i, 3).Value = "Not Found"
Else
Cells(i, 3). Value = foundSerial.Address
End If
i = i + 1
Next
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
How about
VBA Code:
Set foundSerial = Range("A1:A1000").Find(cell.Value, , , xlWhole, , , False, , False)
 
Upvote 0
Solution
Hi Fluff, thanks for your quick reply. Works!!! thank you so much
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,853
Messages
6,127,328
Members
449,376
Latest member
karenmccabe

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top