• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Shortcut to insert pictures in Excel Comments

ChandooAdmirer

New Member
Dear All

Can someone help me with a shortcut to insert images into Excel comments as i need to repeat it manually each time for so many cells. As i am a beginner would appreciate if someone could alternatively write the Macro code, so that i understand and utilize it

Thanking You
 
Good day ChandooAdmirer (we all are)

Why not do one but record your actions with the macro recorder, and assign it a keyboard short cut
 
Hi chandooAdmirer..

just few days back.. I have also tried something..

Use can use this as reference..

or if you have any special criteria.. you need to add.. feel free to post here.. :)

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("d3")) Is Nothing Then
Dim rngList As Range
Dim c As Range
Dim cmt As Comment
Dim strPic As String
strPic = ThisWorkbook.Path & "\Images\"
  With Target
    Set cmt = .Comment
    If cmt Is Nothing Then
      Set cmt = .AddComment
    End If
    With cmt
      .Text Text:=""
      .Shape.Fill.UserPicture strPic & Target.Value & ".JPEG"
      .Visible = False
    End With
  End With
End If
End Sub
 

Attachments

  • Pic As Comment.zip
    134.7 KB · Views: 17
Hi chandooAdmirer..

just few days back.. I have also tried something..

Use can use this as reference..

or if you have any special criteria.. you need to add.. feel free to post here.. :)

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("d3")) Is Nothing Then
Dim rngList As Range
Dim c As Range
Dim cmt As Comment
Dim strPic As String
strPic = ThisWorkbook.Path & "\Images\"
  With Target
    Set cmt = .Comment
    If cmt Is Nothing Then
      Set cmt = .AddComment
    End If
    With cmt
      .Text Text:=""
      .Shape.Fill.UserPicture strPic & Target.Value & ".JPEG"
      .Visible = False
    End With
  End With
End If
End Sub


Dear Debraj,

Really great to hear from you. Debraj, as am a beginner am not yet clear on how to run this macro, tried extracting your zip file, then in the excel sheet, right clicked view code, saved and closed it, and used the keystroke alt+f8 to run the macro, however did not find any changes

Also am attaching the file, for which i have manually put in the images into the comments. Tried Creating a macro, with record a macro button, but after saving it i tried to run the macro. Got some error please can you help with more detail. Am sorry am asking you some basic stuff, but it will help me and really be valuable

Thanking You
Aditya
 
Dear Debraj,

Really great to hear from you. Debraj, as am a beginner am not yet clear on how to run this macro, tried extracting your zip file, then in the excel sheet, right clicked view code, saved and closed it, and used the keystroke alt+f8 to run the macro, however did not find any changes

Also am attaching the file, for which i have manually put in the images into the comments. Tried Creating a macro, with record a macro button, but after saving it i tried to run the macro. Got some error please can you help with more detail. Am sorry am asking you some basic stuff, but it will help me and really be valuable

Thanking You
Aditya
 
Hi Aditya,

I never mind regarding basic or advance.. but i curious on your this line.. :)
Aditya said:
Also am attaching the file, for which i have manually put in the images into the comments.

Please upload..
 
Hi Aditya,

I never mind regarding basic or advance.. but i curious on your this line.. :)


Please upload..

Dear Debraj,

Tried to upload the file got an error message its too large. Am uploading an image of the file. Will create anotehr excel file, without all the images, and try to upload again. Maybe then it would allow me to uploadMicrosoft Excel - fabric_cards_available_2013-10-03_17-34-28.jpg

Thanking You
 
Back
Top