Hello again,
My apologies, the code was not very clear, and also incorect as it was not opening the file to write in it.
Please find below a correction.
VBA Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
Dim myRange As Range
' you enter here the range to be logged if modified
Set myRange = ThisWorkbook.Worksheets(1).Range("N5:N6")
Dim shareWbPath As String
' you enter here the local path to the synced file on your PC
' you need to put the full path
shareWbPath = "C:\Users\XXX\OneDrive\Discounted_orders.xlsm"
Application.ScreenUpdating = False
If Not Intersect(Source, myRange) Is Nothing Then
With Workbooks.Open(shareWbPath)
' if i understood corectly, you put the name of the user
' 2 columns to the right on the shared workbook (it's the offset part)
.Worksheets(2).Range(Intersect(Source, myRange).Address).Offset(0, 2).Value2 = Application.UserName
.Save
.Close
End With
End If
Application.ScreenUpdating = True
End Sub
However opening and closing the file at each "successful" modification can be quite heavy. Maybe it is better to send all modifications to the shared workbook once the current file is closed, or saved. But it is just my opinion. I mean it is already a tricky question when the
Review > Show changes tab exists...