Link to home
Create AccountLog in
Avatar of WTC_Services
WTC_Services

asked on

MS Excel VBA conditional check ok/ignore

Hi,

I currently have a VBA script that checks my spreadsheet for errors or blank fields before printing. At the time being it simply alerts the user to the error, then cancels the print job forcing them to fix the problem. How can I provide the option to either ignore the error (continuing the print) or accept the error (canceling the print).

Thanks!

My Code:

Sheets("data").Select
    If Range("K14") = "" Then
        MsgBox "TESTER NOT SELECTED"
        Range("K14:P14").Select
        Exit Sub
    End If
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of WTC_Services
WTC_Services

ASKER

Imnorie,

This is very good thank you! How can I change it so that the users options are either "ignore" (to continue) or "Check" (to cancel print and go to the cell"

Thanks
In addition to this,

Seeing as though this may result in 10-20 consequential error boxes popping up (which I am sure users ill find annoying), is there a way i can display multiple errors in the one message box.

Eg.

Data Sheet Error:

TESTER NOT SELECTED
REVIEWER NOT SELECTED
LOCATION NOT SET
DATE NOT ENTERED

Do you wish to cancel print?

Yes/No
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Looks like GreenMoon has dealt with the extension to your question.

I'm afraid you can't have an Ignore button and cancel button on a built-in message box.

You can only have a Abort/Retry/Ignore.

In the code I posted the Cancel button does what you want it to.

The only combinations with a Cancel button are Yes/No/Cancel, Ok/Cancel, Retry/Cancel.