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

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
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,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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