Hi All,
I have the following code that works great:
The problem is that it seems to run again and again since the target cell is changing. Is there a way to only allow the code to run once?
I have the following code that works great:
Code:
Private Sub Worksheet_Change(ByVal target As Range)
If Not Intersect(target, Range("M21:M6000")) Is Nothing Then
On Error Resume Next
If target.Cells.Count > 1 Or IsEmpty(target) Then Exit Sub
Dim countIN As Integer
countIN = Application.WorksheetFunction.CountIf(Range("M21:M6000"), "*Inquiry*")
If target.Cells Like "*Inquiry*" Or target.Cells Like "*inquiry*" Then
target.Cells = "Inquiry " & countIN
End If
End If
End Sub
The problem is that it seems to run again and again since the target cell is changing. Is there a way to only allow the code to run once?