Worksheet changed stopped working

theheed

New Member
Joined
Aug 20, 2008
Messages
25
Hi

I have been using the following code for a while to track changes to a row and logging date and username, plus change dates to the 1st of the month when entered. However, it has stopped working in the sense it no longer does the changes when a value changes on the row. Please help

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim changerow As Integer
    Dim changeusername As String
    changeusername = ReturnUserName()
    changerow = Target.Row
    Application.EnableEvents = False
    Range("AO" & changerow).Value = Now()
    Range("AP" & changerow).Value = changeusername
    Application.EnableEvents = True
    If Target.Column = 24 And IsDate(Target.Value) Then
        Application.EnableEvents = False
        Target.Value = DateSerial(Year(Target.Value), Month(Target.Value), 1)
        Application.EnableEvents = True
    End If
      If Target.Column = 21 And IsDate(Target.Value) Then
        Application.EnableEvents = False
        Target.Value = DateSerial(Year(Target.Value), Month(Target.Value), 1)
        Application.EnableEvents = True
    End If
End Sub
 
JONMO's Idea


If you didn't find any other occurances of

Application.EnableEvents = False

Then you'll need error handling in the sub

probably

on error goto Worksheet_Change_Err

Worksheet_Change_Err:
'blah
Application.EnableEvents = True
exit sub

because it could well be that sub routine disabling itself
!!
 
Upvote 0

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.

Forum statistics

Threads
1,225,156
Messages
6,183,244
Members
453,152
Latest member
ChrisMd

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