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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
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,215,599
Messages
6,125,751
Members
449,258
Latest member
hdfarid

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