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
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
has the following been called somewhere else
Application.EnableEvents = False

and i believe changes caused by Formula recalc's don't trigger the change event
 
Upvote 0
Charles, no formulas in the cells.

Would it work if i put a Application.EnableEvents = True in before the variables say?
 
Upvote 0
is there any other code in the workbook that would contain
Application.EnableEvents = False

have you recently switched excel versions
have the users now got to enable macros?
 
Upvote 0
There is a few in various bits of the code, I will remove these and try.

I force Macros on at the start through some sheet hiding etc, and still 2000.
 
Upvote 0
Check if Events are currently disabled...

In the VBA window, click View - Immediate Window
Enter
?Application.EnableEvents

If that returns false, then events are disabled.

Type this to enable them
Application.EnableEvents = True
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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