G
Glenn
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
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