I have created on excel a list of products with item number, description and amount in stock. so I want to do is: every time I place the pointer over the item number to popup a window with the picture of the product.
put this sub in the workbook object bit
in the activecell line put in your cell values.
create a userform called userform2 but put nothing in it
when you double click on your cell it will display the picture
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
If ActiveCell.Value = "your pic reference" Then
UserForm2.Picture = LoadPicture("c:\your picture file"
UserForm2.Show
Else: End If
If ActiveCell.Value = "your second pic ref." Then
UserForm2.Picture = LoadPicture("C:\your second pic file"
UserForm2.Show
Else: End If
End Sub
hope it helps
Andrew299 It may have hit every branch on its way out of the ugly tree, but hey! It works. (sometimes)
You could also use the worksheet_selectionchange event, to get the number of clicks required down to 1. If you really want it to be a hover event, then you need to add objects behind your cell contents and use the mouseover event for the objects. But that's a lot of work... Rob
Dear andrew299 thanks for the support but I can’t make it work at all. Would you explain me whit more details.
I am kind of new on this, and I do not understand much of VBA and I’m using Excel XP in Spanish
Dear andrew299 I finally work it out it was very simple thanks a lot for the tip.
But now how can I apply it for 2,200 different items?
Or how can I make de loop?
you will have to change the filenames of the pictures to whatever you are using in the sheet or visa versa.You have to change to the correct folder as well c:\....
then you only need these two lines instead of all of above (exluding sub and end sub of course)
try it and report back
andrew299 It may have hit every branch on its way out of the ugly tree, but hey! It works. (but don't quote me on that)
Dear andrew299 the new way it work just perfect thanks again for the tip
But now I’m stock again with another issue: on the same list of items I have 2,200 item number with their own description but I only have 2,000 pictures at all, when I double click on a item that don’t have a picture it will show a Run-time error ‘53’ that said, picture not found. How can I fix it so if y click on a cell that doesn’t have a picture just ignore the command ?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.