Hello,
I am making a top 150 selling products report. It shows the stock number, the name of the product and then some sales info. I am using the following code to set a comment in the cell with the product name to show an image of the product. The code sets the image is based on a path that is defined in a different cell in the same row. It runs fine for half or more of the report, then it errors out saying it is out of memory. How can I fix this?

Here is my code:

Sub SetCommentPicPathSelection()

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

    Dim lastrow As Long
    Dim cell As Range
    Dim i

    lastrow = Sheet5.Range("A" & Rows.Count).End(3)(1).Row

    For i = 3 To lastrow
        Set cell = Sheet5.Range("I" & i)
        SetCommentPicture cell.Offset(0, -6), cell.Value
    Next i
    
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End Sub

Sub SetCommentPicture(cell As Range, imagePath As String)

    Dim cm As Comment

    'Get the comment
    If cell.Comment Is Nothing Then
        Set cm = cell.AddComment
    Else
        Set cm = cell.Comment
    End If

    'Clear any text
    cm.Text ""

    'Set comment properties (dimensions & picture)
    With cm.Shape
        .Width = Application.InchesToPoints(2.25)
        .Height = Application.InchesToPoints(2.25)
        .Line.Visible = msoFalse
        .Fill.UserPicture (imagePath)
    End With

End Sub