DwinZly

Board Regular
Joined
Oct 26, 2009
Messages
56
I have created a macro that logs the changes of each cell in the comments of that cell but for some reason, I keep getting an "Out of Memory" error. This is being called from a userform. Can someone please tell me why I keep getting this error? Code below:

Code:
Sub LogChanges(RowImIn As String)
Dim varComment As String
Dim c As Comment


With ActiveSheet.Cells(RowImIn, 11)
    On Error Resume Next
    Set c = .Comment
    On Error GoTo 0
    If c Is Nothing Then
        ActiveSheet.Cells(RowImIn, 11).AddComment "Updated on " & Format(Now(), "mm/dd/yy hh:mm") & " by " & Inits & " from " & ActiveSheet.Cells(RowImIn, 11).Value
    Else
        varComment = c.Text
        ActiveSheet.Cells(RowImIn, 11).ClearComments
        ActiveSheet.Cells(RowImIn, 11).AddComment varComment & vbNewLine & "Updated on " & Format(Now(), "mm/dd/yy hh:mm") & " by " & Inits & " from " & ActiveSheet.Cells(RowImIn, 11).Value
    End If
End With


End Sub

Code:
Function Inits() As String

Dim objword As Object
Set objword = CreateObject("Word.Application")
Inits = objword.UserInitials
objword.Quit
End Function

Thanks
 
Last edited:

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
This seems to work fine.

I am not sure I would open a word doc each time, I personally in the sub would dim Inits as string
Inits = application.username

I assume RowImIn is being got from somewhere else. That's the only bit I haven't tested as I its not in this subroutine
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,921
Messages
6,122,280
Members
449,075
Latest member
staticfluids

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