Alert - Msgbox

ashani

Active Member
Joined
Mar 14, 2020
Messages
345
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm using the below coding - is it possible if user select No in the message box than in G15 it says Alert ?

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.CountLarge > 1 Then Exit Sub
  If Not Intersect(Target, Range("C10")) Is Nothing Then
    If LCase(Target.Value) Like "*yes*" Then
      MsgBox "Test", vbYesNo + vbCritical, ("*** TEST ***")
      End If
End If
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try using
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim ans As string
  If Target.CountLarge > 1 Then Exit Sub
  If Not Intersect(Target, Range("C10")) Is Nothing Then
    If LCase(Target.Value) Like "*yes*" Then
      ans = MsgBox("Test", vbYesNo + vbCritical, ("*** TEST ***"))
      If ans = vbNo Then Range("G15").Value = "ALERT"
      End If
End If
End Sub
 
Upvote 0
Thank you so much @Michael M

Sorry I forgot to add - Is it possible to clear contents in cell G15 if user clear the value in C10.
 
Upvote 0
At what point will the user clear G10?
Before or after the MsgBox ?
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,669
Members
448,977
Latest member
moonlight6

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