I'm pretty new to VBA, and my boss wants me to add in pictures for each of the serial tags of the inventory we have, and for them to appear when the cursor is hovered over the cell. It would be a pain to do this by hand, as there are 1000+ rows to the excel sheet. I have a folder with pictures with matching serial numbers as the file name (.jpg files), and need to map them to a row in the excel sheet with each serial number in it already. Here is what the excel sheet looks like:
I have tried using some VBA code to no avail, and I fear that if this code were to work it would simply flood the sheet with pictures without size limits and not confined to the cell at all.
Sub insertpic()
Range("C1:C1028").Select
Dim imgselect As String
Dim i As Integer
For i = 1 To 1028
Range(i & "3").Activate
imgselect = CStr(ActiveCell.Value)
ActiveSheet.Pictures.Insert "C:\Users\(username)\Desktop\(picture folder)"& imgselect & ".jpg"
Next i
End Sub
I get several different errors, most recently that it has trouble implementing the picture insert function. Any help is appreciated, if all else fails inserting them as formatted comments is what I can resort to.