Macro - Workbook change for columns and value in one constant column

katy6228

New Member
Joined
Aug 17, 2020
Messages
1
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I would like to set up a macro to record the modified date in column "AU" if any change in column "A:AT"
I am using the below VBA code to proceed but the modified date keep moving to right when I updating the column.
May I have the advice to fix the modified date in column "AU"? Thank you!

For Example:
Changed in column A -> value modified date in column AU
Changed in column B -> value modified date in column AV
Changed in column C -> value modified date in column AW

VBA Code:
Private Sub Worksheet_Change(ByVal target As Range)
    
    Application.EnableEvents = False
    Dim sourcecolumn As Range
    Dim cell As Range
    Set sourcecolumn = Intersect(target, Range("A:AT"))
    
    If Not sourcecolumn Is Nothing Then
        For Each cell In sourcecolumn
            cell(1, "AU").Value = Now()
        Next cell
    End If
    
    Application.EnableEvents = True

End Sub
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try:
Rich (BB code):
cells(1, "AU").Value = Now()
 
Upvote 0
How about
VBA Code:
Cells(cell.Row, "AU").Value = Now()
 
Upvote 0

Forum statistics

Threads
1,214,810
Messages
6,121,690
Members
449,048
Latest member
81jamesacct

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