msgbox when only one cell is altered?

AwesomeSteph

Board Regular
Joined
Aug 18, 2017
Messages
80
I am struggling with VBA to only display a message box when one cell is altered. What I have works but then if any other cell changes the msgbox continues to prompt the user. please help, this is tool I built for many users and I only want the msgbox to appear when B12 on sheet 1 has anything in it not when any other cell is touched multiple users will be going into the workbooks and I only want the initial person filling it out to be prompted.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False

Dim MsgTitle, MsgPrompt As String, Ret As Integer
MsgPrompt = "Is this either a New Task or a Technical Change?"
MsgTitle = "Possible Review Required"
If Sheets(1).[B12].Value <> "" Then
       Ret = MsgBox(MsgPrompt, vbYesNo, MsgTitle)
        
    End If
If Ret = vbNo Then
Sheets(8).Activate
MsgBox "Check (Review Not Required) Boxes on lines 1 and 2 on xxx Form"
End If
If Ret = vbYes Then
MsgBox "Ensure Form is included with deliverable"
End If
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
See if this works (note that I restructured your code slightly)...
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim MsgTitle, MsgPrompt As String, Ret As Integer
  If Not Intersect(Target, Range("B12")) Is Nothing Then
    Application.ScreenUpdating = False
    MsgPrompt = "Is this either a New Task or a Technical Change?"
    MsgTitle = "Possible Review Required"
    If Sheets(1).[B12].Value <> "" Then
      Ret = MsgBox(MsgPrompt, vbYesNo, MsgTitle)
      If Ret = vbNo Then
        Sheets(8).Activate
        MsgBox "Check (Review Not Required) Boxes on lines 1 and 2 on xxx Form"
      Else
        MsgBox "Ensure Form is included with deliverable"
      End If
    End If
    Application.ScreenUpdating = True
  End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,334
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