change log with VBA

Mattlake

Board Regular
Joined
Apr 9, 2020
Messages
91
Office Version
  1. 2021
Platform
  1. Windows
Hi

I hope you can help me with a spreadsheet.

I have a spreadsheet with 3 tabs (AY21-22, AY22-23 and log[hidden]) that I need to track changes on.

I have found

VBA Code:
Private Sub workbook_beforesave(ByVal SaveAsUI As Boolean, cancel As Boolean)

Dim wbLog As Worksheet
Dim iLastRow As Integer

Set wbLog = Sheets("log")
iLastRow = wbLog.Cells(wbLog.Rows.Count, "A").End(xlUp).Row + 1

wbLog.Cells(iLastRow, 1).Value = Environ("username")
wbLog.Cells(iLastRow, 2).Value = Now

End Sub

which works to log the user and when they access.

I want to also log which cells are altered even if it is just which cells are edited. Is this possible?

I have tried googling different ways to final a solution but unable to find anything (not even on youtube)

So it may not even be possible but if a VBA master can tell me that it isnt possible i would be soo happy and relieved.

Regards

Matthew
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
In ten years, you'll be writing code and posting answers for others. if you think its a goal for you.
 
Upvote 0
This site is here to learn. Ask as many questions as you need.
Put your cursor on Cell A1, then Using the Excel menu: Formulas > Name Manager > New > type in the name given and press enter
Hi there,

Was looking for something very similar to this (which is a great tool btw) curious about a couple applications:

1 - If this is in a table and I sort the table, will the change reference correctly rename itself to where it may now sit?
2 - Is there a method of also including the original value and updated value in the log?
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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