msgbox Query

shaylynch

Board Regular
Joined
Nov 11, 2002
Messages
163
hi All,
i have written a macro to update another sheet with certain values, however i am looking for code that if one particular cell is equal to "True" that a MsgBox will ask the question "Are you sure you to Close Project" and if yes that the macro will continue

thanks in advance

Shay
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

BrianB

Well-known Member
Joined
Feb 17, 2003
Messages
8,127
Something like this :-
Code:
Dim rsp As String
If Worksheets("Sheet1").Range("A1").Value = "True" Then
    rsp = MsgBox("Are you sure", vbYesNo)
    If rsp = vbNo Then
        Exit Sub
    End If
End If
'- continue
 

shaylynch

Board Regular
Joined
Nov 11, 2002
Messages
163
hi Brian,
thanks for your reply,
the code works fine, but the only issue i have now is that, this subroutine isn't always used and when that no isn't there, the macro, outside of this sub doesn't seem to work now.

Shay
 

BrianB

Well-known Member
Joined
Feb 17, 2003
Messages
8,127
You will need to change it to do what you need.
I have put Exit Sub which ends the macro.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,530
Messages
5,572,686
Members
412,481
Latest member
nhantam
Top