message box yes no macro

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,220
Hello all
A member of the Excel forum kindly helped with this code and I want to expand it to saying.

Number of supplier email missing
Proceed Yes or No
if yes then action my code
if no then end function

Code:
With Sheets("Data")
        LastRow = .Range("B" & Rows.Count).End(xlUp).Row
        Set rng = .Range("AA2:AA" & LastRow).SpecialCells(xlCellTypeBlanks)
    End With
    MsgBox "Number of Supplier Emails missing: " & rng.Count
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
How about
Code:
With Sheets("Data")
        lastrow = .Range("B" & Rows.count).End(xlUp).Row
        Set Rng = .Range("AA2:AA" & lastrow).SpecialCells(xlCellTypeBlanks)
    End With
    If MsgBox("Number of Supplier Emails missing: " & Rng.count, vbYesNo) = vbNo Then Exit Sub
 
Upvote 0

Forum statistics

Threads
1,215,943
Messages
6,127,820
Members
449,409
Latest member
katiecolorado

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