Conflict between two codes in the same project

anvs

New Member
Joined
Apr 18, 2023
Messages
31
Office Version
  1. 365
Platform
  1. Windows
Hi!

In Col A process references are registered.
In Col B the code registers the DateTime of the entry of each process.
In Col C the code records the DateTime of any change in the reference of each process.
For that I use the following code:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim LastDataEntry

If Target.Column > 1 Then Exit Sub
Application.EnableEvents = False
LastDataEntry = Target: Application.Undo

On Error Resume Next
If LastDataEntry <> Target Then
Target = LastDataEntry
If Target(, 2) = "" Then
Target(, 2) = Now
else
Target(, 3) = Now
End If
End If

In prototype it works fine.

I recently realized the need to make changes to the first 20 records (A2:A20) unfeasible.
Please, from rollis 13 I have the following code:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A2:A20")) Is Nothing Then
Application.OnKey "{DELETE}", ""
Else
Application.OnKey "{DELETE}"
End If
End Sub

In prototype it works fine.

When I try to use both codes in the project, the second one doesn't work.
I ask for your help because I cannot understand the conflict.
Thanks in advance.
anvs
 
FINALLY!
:))
Many thanks for the help and patience.
Good luck and health!
anvs
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,215,133
Messages
6,123,235
Members
449,092
Latest member
SCleaveland

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