Why is my macro not working?

mcintoshmc

Active Member
Joined
Aug 10, 2007
Messages
277
I've used this macro for over a year, and for some reason it just stopped. Column O is still the correct column, and the date is supposed to reflect in column W.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rInt As Range
Dim rCell As Range
Dim tCell As Range

Set rInt = Intersect(Target, Range("O:O"))
If Not rInt Is Nothing Then
For Each rCell In rInt
With rCell.Offset(0, 8)
.Value = Now
.NumberFormat = "mmm d, yyyy"
End With
Next
End If
End Sub
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
How is it not working?
Is it not doing anything when you make a manual entry in column O?

If that is the case, try manually running this short macro and try again:
VBA Code:
Sub ReenableEvents()
    Application.EnableEvents = True
End Sub
 
Upvote 0
I added a couple of lines of code to prevent perpetual looping.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rInt As Range
Dim rCell As Range
Dim tCell As Range
Application.EnableEvents = False
Set rInt = Intersect(Target, Range("O:O"))
    If Not rInt Is Nothing Then
        For Each rCell In rInt
            With rCell.Offset(0, 8)
                .Value = Now
                .NumberFormat = "mmm d, yyyy"
            End With
        Next
    End If
Application.EnableEvents = True
End Sub

That plus what @Joe4 offered should fix it.
 
Upvote 0
I figured it out. Excel was updated to a new version at work, and Macros were disabled. Thanks.
Ah yes, those important details make all the difference! ;)
 
Upvote 0
Excel was updated to a new version at work
IT strikes again! You'd think they would retain the system settings when doing upgrades, but many of them don't do it and the uers have to then go in and reset everything.
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,391
Members
449,080
Latest member
Armadillos

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