G
Guest
Can I include a picture in a formula i.e. if cell a26 >90% then show picture
x, if less then show picture y?...
x, if less then show picture y?...
Gord Dibben said:PACF
Not a formula, but using worksheet event code.
See JE McGimpsey's site for code and instructions.
http://www.mcgimpsey.com/excel/lookuppics.html
Gord Dibben Excel MVP
Dave Peterson said:Maybe you could do something like JE McGimpsey does at:
http://www.mcgimpsey.com/excel/lookuppics.html
Hi Dave,
I tried the following as below, but its ends up with a compile error.
Thanks for trying.
Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
With Range("E30")
For Each oPic In Me.Pictures
If oPic.Name = "Picture 1" Then
'do nothing
Else
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
Exit For
End If
Next oPic
End With
End Sub
Hi Dave,
Thank you, sorry about that, I don't dive into the VB editor very often so
it doesn't stick in the grey cells.
Thanks again for your help and quick response.
Dave Peterson said:Maybe you can just check the name and then do nothing for that name:
Option Explicit
Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
With Range("F1")
For Each oPic In Me.Pictures
If oPic.Name = "Nameofpicturethatshouldnotchange" Then
'do nothing
Else
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
Exit For
End If
End If
Next oPic
End With
End Sub
I am trying to do the same thing as the other gentleman but apparently I am
missing something. I have entered what you have below but my logo "Picture
1" keeps disappearing everytime I use the other event (I have it inserting a
signature upon a person's name).
***Please help!
chrstrcy said:Yes, I changed the code to read "Picture 1" and then I inserted the picture
where I needed it in the file and named it Picture 1. But then when I test
by changed the signature event it deletes the picture 1.
Yes, and I want it to show in cell A1 - does this need to be noted in the
code as well?? I will try what you have below. Thank you for your help.