Worksheet_Change Triggering 3 times.

atrels

New Member
Joined
Aug 2, 2020
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hi All,

My worksheet_change VBA code is located on Sheet1.

There is data validation on this worksheet, so if a user enters data outside the restrictions, then type in "N/A" the macro triggers 3 times.

Why is this the case? Is there any way I can solve it so it only runs once? My code is below.

VBA Code:
Option Explicit

Option Compare Text

Sub Worksheet_Change(ByVal Target As Range)
    Dim rInt As Range
    Dim k As Range
    Dim Substitute As Range
    Dim C As String
    Dim R As String
    With Target
        If .Cells.Count = 1 And Not (Application.Intersect(.Cells, Range("A14:T999")) Is Nothing) Then
            If .Value = "N/A" Then
                Application.EnableEvents = False
                Initials_Comment_Box.TextBox1 = Target.Address
                Initials_Comment_Box.Show
                Application.EnableEvents = True
            End If
        End If
    End With
End Sub

I found here a claim: "Three times: once for the user's first, invalid entry; once for data-validation's restoration of the previous value; and once for the user's updated entry (or acceptance of the restored value, selecting a different cell)."

I need the workbook to function normally - E.g. Be able to still select multiple cells and delete them.
 

Some videos you may like

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

atrels

New Member
Joined
Aug 2, 2020
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Could anyone help me?


E.g. Normal Function.

enter image description here

E.g. Triple trigger from Data Validation Function.

enter image description here
 

atrels

New Member
Joined
Aug 2, 2020
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Any help would be greatly appreciated.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,971
Messages
5,575,295
Members
412,653
Latest member
JyothiGrace
Top