MsgBox cancel or Continue macro

jl2509

Board Regular
Joined
Oct 30, 2015
Messages
198
Office Version
  1. 365
Platform
  1. Windows
Hi

Can anyone advise for a macro that will check cell A2 for a value of "True"
If cell A2 does contain "True" then return a messagebox "Are you sure this is the correct selection?" vbyesno
if vbyes is pressed then continue with code or if no is selected exit sub

This must be run from a command button as this is a print routine.

I know this is miles away, but this is my thought process.

If Range("A2") = True Then

MsgBox "Are you sure this is the correct selection?", vbYesNo
if response = vbYes
continue code
.....
.....
if response = vbno then
exit sub


many thanks
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Code:
Sub CheckIt()    Dim s As String
    
    'set message
    s = "Are you sure this is the correct selection?"
    
    'make cae insesnsitive
    If UCase([A2]) = "TRUE" Then
        'ask question and leave if negative
        If MsgBox(s, vbYesNo) = vbNo Then Exit Sub
    End If
    
End Sub
 
Upvote 0
Thank you for the repsonse,

I know I cross posted but only in my haste to get a solution.

Thanks
 
Upvote 0
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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