One way...
Option Explicit
Sub testme()
Dim myCell As Range
Dim myRng As Range
Dim testStr As String
Dim PictFileName As String
Set myRng = Selection
For Each myCell In myRng.Cells
PictFileName = myCell.Offset(0, -1).Value
testStr = ""
On Error Resume Next
testStr = Dir(PictFileName)
On Error GoTo 0
If testStr = "" Then
'do nothing, picture not found
Else
If myCell.Comment Is Nothing Then
myCell.AddComment Text:="new comment here!" 'or ""
End If
myCell.Comment.Shape.Fill.UserPicture PictFileName
End If
Next myCell
End Sub
This assumes that the full filename of the picture that should be used is to the
left of the cell.
Select your range that should get the comments and try it out.
If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
tryer wrote:
Can anyone tell me if it is possible to insert a number of pictures (one
for each cell in a column) automatically. I can do this manually but
would like to automate the process for say 100 rows. I have the picture
jpeg number in an adjacent cell in the same row.
Thanks in advance
--
tryer
------------------------------------------------------------------------
tryer's Profile: http://www.excelforum.com/member.php...o&userid=16546
View this thread: http://www.excelforum.com/showthread...hreadid=466666
--
Dave Peterson