Insert picture

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:43 PM GMT


QUESTION: Dear Sir: Can you help me insert a particular picture in multiple sheets of aworkbook.

ANSWER: shahadat_uiu,

Sub ABC() Dim sh as workbook for each sh in Activeworkbook

 ' exlude some sheets
 if sh.Name <> worksheets("Sheet3").Name and _
    sh.Name <> worksheets("Sheet5").Name  then
      application.Goto sh.Range("B9"), True "C:\myfolder\mypictures\picture1.jpg
 end if

Next End Sub

would be one way.

---------- FOLLOW-UP ----------

QUESTION: after running the code it returns the followings at the line

for each sh in Activeworkbook

run time error '438' object does not support this property or methods.



Remember, that was just sample code - you didn't give enough information to write code for a specific situation. I have tested this version of the code and it works for me, but you will need to adjust it to fit your requirements.

Sub ABC() Dim sh As Worksheet Dim pick As Picture For Each sh In ActiveWorkbook.Worksheets

' exlude some sheets
If sh.Name <> Worksheets("Sheet3").Name And _
   sh.Name <> Worksheets("Sheet5").Name Then
     Application.Goto sh.Range("B9"), True
     Set pick = sh.Pictures.Insert("j:\myfolder\mypicture.jpg")
     pick.Top = ActiveCell.Top
     pick.Left = ActiveCell.Left
End If

Next End Sub


I have a product list and I would like a thumbnail of the product to appear when the mouse goes over the cell just like it dies with inserted comments.

Also, if that can be done, I would then like the same result with a drop down list.


You can use the comments feature to insert a picture as your comment. Insert a comment and right click on the border of the comment. Choose format comment and then pick colors and lines. Choose the color drop down and select fill effects and then picture and insert your picture.

I don't know how to do the same with a drop down list, but hopefully this helps some,



©2024 eLuminary LLC. All rights reserved.