instr, like, and wildcard

spq24

Board Regular
Joined
Jan 18, 2010
Messages
52
I need to compare two lists that don't exactly match. I've tried using find and I've tried using like and the wildcard. I keep getting an error when I use the wildcard with a variable in an instr function here's the code I'm using:


Sub Mark_cells_in_column()
Dim FirstAddress As String
Dim MyArr As Variant
Dim Rng As Range
Dim I As Long
Dim Acell As Range
Dim Bcell As Range
With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Set ARange = Sheets("Attendees ND").Range("C2:C1310")
For Each Acell In ARange

'Search Column or range
Set BRange = Sheets("Q1 Closed Deals").Range("A:A")

For Each Bcell In BRange
If InStr(ActiveCell.Value, Acell) Then

Do
'mark the cell in the column to the right if "Ron" is found
Bcell.Offset(0, 4).Value = "Yes"
Loop While Not Bcell Is Nothing
End If
ActiveCell.Offset(1, 0).Activate
Next Bcell
Next Acell

With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,224,587
Messages
6,179,740
Members
452,940
Latest member
Lawrenceiow

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