Hi All,
I understand that macro's and shared documents don't really go hand in hand, below is a code that adds a note to every cell entry, with the username and a time stamp,
when I upload the document the macro stops working, is it possible to have this kind of macro run on a shared document? Thanks in advance.
I understand that macro's and shared documents don't really go hand in hand, below is a code that adds a note to every cell entry, with the username and a time stamp,
when I upload the document the macro stops working, is it possible to have this kind of macro run on a shared document? Thanks in advance.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim oComment As Comment, cell As Range, strPrev As String
If Not Intersect(Target, Columns("M:NM")) Is Nothing Then
For Each cell In Intersect(Target, Columns("M:NM"))
Set oComment = Nothing
On Error Resume Next
Set oComment = cell.Comment
On Error GoTo 0
If Not oComment Is Nothing Then
strPrev = Mid(oComment.Text, InStr(oComment.Text, "Current value: ") + 15, 999)
oComment.Text Text:=Format(Now, "mmm dd, yyyy h:mm AM/PM")
ElseIf Not IsEmpty(cell) Then
cell.AddComment
cell.Comment.Text Text:=Format(Now, "mmm dd, yyyy h:mm AM/PM ") & Application.UserName
cell.Comment.Shape.Width = 150
cell.Comment.Shape.Height = 35
End If
Next cell
End If
End Sub