Search for multiple values in a column and show an alert message

sofas

Well-known Member
Joined
Sep 11, 2022
Messages
559
Office Version
  1. 2021
  2. 2019
Platform
  1. Windows
مرحبًا، أود الحصول على كود يبحث عن عدة قيم في عمود، فليكن b، بدءًا من الصف 5. يمكن أن تكون القيم نصية أو رقمية، على سبيل المثال.
s= صفيف ("test55"، "r699"، "rtmy"، "Comx"، "62")
المطلوب هو إظهار رسالة تنبيهية عند التأكد من عدم وجود قيمة. ومع ذلك، إذا تم العثور على واحد فقط أو أكثر، فلن يتم فعل أي شيء
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi, I would like a code that searches for multiple values in a column, let it be b, starting from row 5. The values can be text or numeric, for example.
s= array("test55", "r699", "rtmy", "Comx", "62")
What is required is to show a warning message when it is confirmed that there is no value. However, if only one or more are found, nothing will be done

Moderators, please delete post No. 1. Translation error
 
Upvote 0
Please post you code so we can better understand what you've done so far.
use
VBA Code:
your code here
 
Upvote 0
Please post you code so we can better understand what you've done so far.
use
Hello... I don't have any code yet. What I'm trying to do is search for multiple values in column B that are already mentioned in the code.And show msgbox if nothing found. It is not shown when checking that at least one value exists
 
Upvote 0
Something like this.
Code:
Sub test()
    Dim s, x&
    s = Array("test55", "r699", "rtmy", "Comx", "62", 62)
    x = Application.Sum(Application.IfError(Application.Match(s, _
        Range("b5", Range("b" & Rows.Count).End(xlUp)), 0), 0))
    If x = 0 Then MsgBox "Worning", vbCritical
End Sub
 
Upvote 1
Solution
Something like this.
Code:
Sub test()
    Dim s, x&
    s = Array("test55", "r699", "rtmy", "Comx", "62", 62)
    x = Application.Sum(Application.IfError(Application.Match(s, _
        Range("b5", Range("b" & Rows.Count).End(xlUp)), 0), 0))
    If x = 0 Then MsgBox "Worning", vbCritical
End Sub
Thank you. That's what I'm looking for
 
Upvote 1

Forum statistics

Threads
1,221,818
Messages
6,162,154
Members
451,749
Latest member
zack_ken

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