How to Automate Display of Pictures Using Comments with VBA

Поделиться
HTML-код
  • Опубликовано: 8 окт 2024
  • We can automate the display of pictures using comments with VBA in Microsoft Excel. The display of pictures automatically can be useful in a variety of situations.
    The code is given below:
    Sub showPic()
    For Each cell In Selection
    MyPicture = "C:\Users\takyar\Pictures\PillowCases\" & cell.Value & ".jpg"
    With cell.AddComment
    .Shape.Fill.UserPicture MyPicture
    End With
    Next cell
    End Sub
    Details at this link:
    www.exceltraini...

Комментарии • 29

  • @paulang8267
    @paulang8267 11 месяцев назад

    I have immense respect for you, one of the best, Thank you Guru Takyar

  • @johnabram4159
    @johnabram4159 3 года назад

    I found it very useful. Have been searching for it for a long time. I have so many places where I wanted to use it. Thank you.

  • @redhaakhund1271
    @redhaakhund1271 2 года назад

    Excellent sir👍👍👍👍👍

  • @philip23man
    @philip23man 4 года назад

    Very useful, Thank you so much!

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 года назад

      Glad you found this useful. Please share with your friends also.

  • @dlin66
    @dlin66 3 года назад

    Thanks.. Your code is useful.

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 года назад

      Glad to hear that. Please share the VBA tutorials with your friends too.

  • @usachotikasiri8997
    @usachotikasiri8997 9 лет назад

    Very useful, thanks a lot.

  • @MrRossss1
    @MrRossss1 8 лет назад

    Hi Dinesh, thank you for your great videos. Can I just ask please - when I run this for a larger selection of say 200 cells, my screen goes unresponsive until all the pictures are added, which takes a fair while. Is there any way to avoid this or is it that my laptop is just too slow? Thank you

    • @MrRossss1
      @MrRossss1 8 лет назад

      I should have said that I'm getting the .jpg from the actual cell instead of from a file but wouldn't have thought this would make any difference. Thank you :)

  • @usachotikasiri8997
    @usachotikasiri8997 9 лет назад +1

    Hi, Mr.Dinesh
    If we need specific size of picture in insert comment. Please kindly advice me. Thank you in advance.

    • @debashishbhattacharjee7206
      @debashishbhattacharjee7206 8 лет назад +1

      Please try below, for me it worksSub showPic()For Each cell In SelectionMyPicture = "C:\Users\your address\" & cell.Value & ".jpg"With cell.AddComment.Shape.Fill.UserPicture MyPicture
      .Shape.ScaleWidth 5.87, msoFalse, msoScaleFromTopLeft
      .Shape.ScaleHeight 2.26, msoFalse, msoScaleFromTopLeft
      End WithNext cellEnd Sub

  • @gerardvaneggermond9967
    @gerardvaneggermond9967 4 года назад

    Hi, I found this very interesting, but a question can you make a search list for and can you make the pictures bigger? Can you help me?

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 года назад

      You can change the size of the comment shape like so:
      .Shape.ScaleHeight 3.50, msoFalse, msoScaleFromTopLeft
      .Shape.ScaleWidth 7.87, msoFalse, msoScaleFromTopLeft

  • @erickamontero1809
    @erickamontero1809 6 лет назад

    But will it stay there if I decided to filter and search for a particular item? I don't think so

  • @lazarusborjz3412
    @lazarusborjz3412 9 лет назад

    Hi Mr. Dinesh, It would very appreciated if you could help me in my problem, on the sheet1 of a checklist item 1 in one particular cell which i use to type the picture number from 1 upto 8 picture depend on the item which required. like 2 picture, 4 or 5 or 8 max. same also in item 2, item 3 upto 100 item or row. which required picture. on the sheet 2 the picture should display in a certain range of cell in 12 raw and 8 column just like a rectangle. for 1st item, 2nd, 3rd up to 100. When you click the command bottom, all the picture will be display.
    if 1 picture- selected the size of picture is ex. 250x300
    if 2 picture- selected the size is ex. 150x250 x2
    if 3 picture-selected the size is ex. 100x100 x3
    up to 8 picture.
    I hope you could help me to program this in command botton.

  • @Dark_Luminary
    @Dark_Luminary 3 года назад

    Is it possible to have the comments appear on the left side of the cell that contains the comment? My comment column is all the way to the right making the comments appear offscreen

  • @Rudronil1001
    @Rudronil1001 5 лет назад

    How to search data and pictures in an Excel seat using multiple search boxes. Same as Student ID card but multiple simultaneously.

    • @Exceltrainingvideos
      @Exceltrainingvideos  5 лет назад

      This link will help: ruclips.net/video/_mdtxRm__V0/видео.html

  • @amarkardile7185
    @amarkardile7185 2 года назад

    how to put this code in userfarm button and particuler sheet2

  • @technicammingguru7876
    @technicammingguru7876 3 года назад

    There is an error called...
    Run time error (some integers written)
    and then there is "The specified File wasn't found"
    Can you please help

  • @darkdevil-xg9zo
    @darkdevil-xg9zo 8 лет назад

    I WANT EMPLOYEE PHOTO IN SEPARATE COLUMN
    CAN U HELP ME OUT

  • @khtoday2553
    @khtoday2553 4 года назад

    How to link comment cell other cell

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 года назад

      How would you use this idea?

    • @khtoday2553
      @khtoday2553 4 года назад

      How would you use the idea.តើអ្នកនឹងប្រើគំនិតនេះយ៉ាងដូចម្តេច។it

    • @khtoday2553
      @khtoday2553 4 года назад

      @@Exceltrainingvideos . So I don't know how to do it?