Find and return yes/no

MojoJojo2023

New Member
Joined
Aug 7, 2023
Messages
9
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
In the below code, I am attempting to find each cell in a given range in a reference data worksheet I have set up. If it does find the cell value within the reference data range, it will return a yes or otherwise return a no. As of right now, I am returning only no for every cell in the range, even though there are matches. Does anyone know a fix that would correct this?:

Sub MatchPB()
VBA Code:
Dim wb As Workbook
Dim bingo As Range


For Each cell In PB.Range("A2:A104")
    With RData.Range("A2:A50")
        Set bingo = .Find(What:=cell.Value, LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
        If bingo Is Nothing Then
        cell.Offset(0, 27).Value = "Yes"
        Else: cell.Offset(0, 27).Value = "No"
        End If
    End With
Next

End Sub

Thanks in advance!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I inserted that into my code, and it is still returning "No" for all items, even if a match formula should return yes.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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