Create Custom Msgbox VBA Multiple Criteria

beginvbaanalyst

Board Regular
Joined
Jan 28, 2020
Messages
141
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

1582722173065.png

What if I want multiple msgboxs per each sheet? I realize I can have two different outcomes to a specific scenario.
Is there a way to use IF, THEN?
For instance, if COLUMN L and COLUMN K equaled ONE then I would want a message to say "Burris article, check sourcing", but if COLUMN L equaled ONE, but column K had ZERO I'd want it to say "contact merchant".
Is there a way to do this?
I don't want it to read for Cell 1 but for the entire Column itself.
Currently my code is
VBA Code:
Sub FilterForBurrisVendor()
 'Selects I1 and entire M column, Range J looks for last populated cell
With Range("I1:M" & Range("L" & Rows.Count).End(xlUp).Row)

    'Column 4, Equal to 1
.AutoFilter Field:=4, Criteria1:=">1", _
Operator:=xlAnd
.AutoFilter Field:=3, Criteria1:="=1", _
Operator:=xlAnd
.AutoFilter Field:=5, Criteria1:="=0"

End With
    'Copies and Pastes Filter Rows into new Worksheet with Name
Sheets("Sheet1").Copy After:=Sheets("MULTIPLE VENDORS NO REGULAR")

ActiveSheet.Name = "BURRIS VENDORS"

If Range("L" & Rows.Count).End(xlUp).Row = 1 Then MsgBox "NO BURRIS ARTICLES"
End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
You say
multiple msgboxs per each sheet
But your code is looking at one sheet.
Also the code is checking to see if there are any visible rows. If there are, then there will be the same number of visible rows for each column.
So unfortunately your request makes no sense to me.
 
Upvote 0
You say

But your code is looking at one sheet.
Also the code is checking to see if there are any visible rows. If there are, then there will be the same number of visible rows for each column.
So unfortunately your request makes no sense to me.

Hi Fluff,
I mean multiple criteria's per sheet. I have code that creates four separate sheets for me.
The msgbox would be if the data met the criteria.
If Range("L" & Rows.Count).End(xlUp).Row = 0 Then MsgBox "NO BURRIS ARTICLES"
^can I read this as in Column L if my range equals 0 then msbox "no burris articles" would pop up?
 
Upvote 0
I'm sorry but this does not make any sense to me.
This line If Range("L" & Rows.Count).End(xlUp).Row = 0 will never be true because the minimum it can return is 1.
Please explain, in words, what exactly you are trying to do.
 
Upvote 0
I would love a msgbox to show up under two conditions:
1) if COLUMN L(BURRIS) presents a value of ""1,"2", or "3" AND COLUMN M shows a value of "1" a msgbox appears saying "Update Sourcing"
2) if COLUMN L(BURRIS) Presents a value of "1", "2", or "3", AND COLUMN M presents a value of "0" a msgbox appears saying "Contact Merchant"

I'm using countif formulas and sometimes my value will equal "0".
Thank you for all of your help.
I know I'm hard to deal with, if you need me to explain it more please let me know.
 
Upvote 0
I'm even more confused, what does this have to do with the code you've posted?

Are you saying that if column L has either a 1 or a 2 or a 3 anywhere in it, then check to see if column M has a value of 0 or 1 anywhere in it?
If so what happens if column M has bot a 1 & a 0?
 
Upvote 0
I'm even more confused, what does this have to do with the code you've posted?

Are you saying that if column L has either a 1 or a 2 or a 3 anywhere in it, then check to see if column M has a value of 0 or 1 anywhere in it?
If so what happens if column M has bot a 1 & a 0?

After everything has been filtered I'm saying if column L has values of 1, 2 or 3 in it and column M is showing values of 1 a custom msgbox will show up.
I believe I figured it out it though, my current code is this
VBA Code:
If Range("L1").Value >= 3 And Range("M1").Value >= 0 Then MsgBox "SEPERATE VENDOR ATTACHED TO BURRIS ARTICLE MARKED AS REGULAR, REACH OUT TO MERCHANT TO CONFIRM IF THIS IS BURRIS"
 
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,568
Members
452,652
Latest member
eduedu

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