Change Log

Nasmin Saheed

New Member
Joined
Jun 11, 2015
Messages
49
Office Version
  1. 365
Platform
  1. Windows
HI,

I wanted to know that, if I changed any field in excel in one column it should appear that what I have done the changes - here multiple changes can happen bu I want the last change report - is possible in Excel? if so plz assist me - Thanks
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
It seems worksheet_change even will be used.
what exactly the report could be? write to sheet or via messge box?
It would help a lot with image/ screenshot or XL2BB attached.
 
Upvote 0
1640686290710.png
 

Attachments

  • 1640686032172.png
    1640686032172.png
    27 KB · Views: 5
Last edited:
Upvote 0
Right click on sheet name, view code, then apply below code in code window
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Lr&, i&, j&
Dim rng As Range, cell As Range
Dim Old()
Lr = Cells(Rows.Count, "A").End(xlUp).Row
Set rng = Range("B2:K" & Lr)
ReDim Old(1 To Lr, 1 To rng.Columns.Count)
Old = rng
    If Not Intersect(Target, rng) Is Nothing Then
        ' save the old value
        Application.EnableEvents = False
        Application.Undo
        Old = rng
        Application.Undo
        Application.EnableEvents = True
            For i = 2 To Lr 'assume changing range starts from row 2
                For j = 2 To rng.Columns.Count + 1 'assume changing range starts from column B
                    If Cells(i, j).Value <> Old(i - 1, j - 1) Then
                        Cells(i, 13).Value = Cells(i, j).Address(0, 0) 'write address into cell
                        Cells(i, 14).Value = Old(i - 1, j - 1) + 0 & " to " & Cells(i, j).Value ' write old and new value into cell
                    End If
                Next
            Next
    End If
End Sub

Screenshot 2021-12-29 090142.png
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,947
Members
449,095
Latest member
nmaske

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