Thread: MACRO
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default MACRO

Glen

This looks like John McGimpsey's code from lookuppics.xls

Download from this site with explanations.

http://www.mcgimpsey.com/excel/lookuppics.html

As written John's code allows for only one picture to be displayed and the
pictures must be stored on the same worksheet as the VLOOKUP formula.

If you need multiple pictures shown from VLOOKUPS.............

Got to Debra Dalgeish's site for a sample workbook from Bernie Dietrick for
adding pictures via selections.

Allows for more than one picture to be displayed on a sheet but also requires
the pictures be stored on same sheet.

http://www.contextures.on.ca/excelfiles.html#DataVal

DV0049 - ClipArt Selection


Gord Dibben MS Excel MVP


On Mon, 28 Jan 2008 14:31:01 -0800, Glenn
wrote:

I have built a macro that will take a clipart picture and post it to a
spacific cell in my worksheet. This is so that the formular used in that
cell will make the macro show the proper picture. I have built on the
worksheet a pictable and names the table. BUT the thing will not work. I
did this back in 2005 but I cannot remember. Below is the macro i built, an
example for the formular for the cell, and a example for the pictable...WHAT
AM I MISSING....do I need to name the picture...I know that there has to be
one thing i have missed...THANKS A LOT FOR YOUR HELP

Sub picture1()
Private Sub Worksheet_Calculate()
Dim oPic As Picture
Dim myCell As Range
Dim myRng As Range

Set myRng = Me.Range("cc37,CE37")

Me.Pictures.Visible = False
For Each myCell In myRng.Cells
With myCell
For Each oPic In Me.Pictures
If LCase(oPic.Name) = LCase(.Text) Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
End If
Next oPic
End With
Next myCell

End Sub
A B
PicTable 1 Picture
Tireman1 Picture 33 (20)
Tireman2 Picture 20
Tireman3 Picture 14
Carlift1 Picture 11
Carlift2 Picture 28
Carlift3 Picture 26
Carlift4 Picture 27
Total1 Picture 31
Total2 Picture 20
Total3 Picture 30

This formular is placed in cell cc37
=vlookup(A20,PicTable1,2,FALSE)

To print picture 33