Find value in list

coop123

Board Regular
Joined
Dec 18, 2018
Messages
66
Office Version
  1. 365
Hello

I want a macro to find a value in a list then carryout further steps.

If value is found proceed to step 1.
If value is not found proceed to step 2.

So far I have no problem if value is found, but if value is not found as expected I get run-time error 91, at this point I want to proceed to step 2. Can someone suggest code to ignor error and proceed to step 2.

I have tried many sites without any success.

Thank you in advance

coop123
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Something along the lines of

Code:
SearchString = "text to search for in range"

Set FindValue = Workbooks("NAME").Worksheets(1).Range("A1:A100").Find(SearchString)
If not FindValue Is Nothing Then
    'Step 1
Else
    'Step 2
End if
 
Upvote 0
Thank you that has solved my problem perfectly. Very much appreciated.

coop123
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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