help with select case statement

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
I have this code section used to confirm a delete. But when even I click No, it still deletes the entry. What is that I am doing wrongly? I don’t seem to figure it out yet. Please help a friend. Thanks
Kelly
Code:
Select Case MsgBox("You are about to delete ID " & Reg1.Value & vbCrLf & "Do you want to proceed?", vbYesNo Or vbQuestion Or vbDefaultButton1, "Are you sure about this?")
        Case vbYes
        Case vbNo
    End Select
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
You don't need a select case to do this

Code:
Sub MM1()
msg=MsgBox ("You are about to delete ID " & Reg1.Value & vbCrLf & "Do you want to proceed?")
If msg=vbNo Then Exit Sub
End Sub
 
Upvote 0
Thanks for the tip. I appreciate it. The point is i was tired and just got too confused.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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