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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
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,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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