View Single Post
  #24   Report Post  
Posted to microsoft.public.excel.misc
chrstrcy chrstrcy is offline
external usenet poster
 
Posts: 7
Default Can I include a picture in a formula i.e. if cell a26 90% the

Ok, here goes:

I have an excel spreadsheet that I am creating to be a Quote for our sales
people. On the top in cell A1 I have our company logo and on the bottom I
have a data validation box (list box) with all the Sales Persons names in it.
Currently when I change the name using the list box that persons
signature(picture) pops up accordingly; however, everytime I change the
salespersons name in the list box the appropriate signature is displayed but
the logo disappears. I keep inserting the Logo back into cell A1, reviewing
the code as you last gave me and change the name in the list box and the logo
disappears once again. I have tried also putting Picture 1 in my PicTable as
well as leaving it out but to no avail. Code is as follows currently:

Option Explicit
Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
With Me.Range("A66")
For Each oPic In Me.Pictures
If LCase(oPic.Name) = LCase("Picture 1") Then
'show it
oPic.Visible = True
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




"Dave Peterson" wrote:

Maybe it's time to describe what you really want and post the current version of
your code.

chrstrcy wrote:

Nope, still not working - that's why I thought the cell needed to be
specified - at a loss at this point. Thanks so much for your continued help.

"Dave Peterson" wrote:

Nope. The code will use the name--not the location.

Did it work when you tried it?

chrstrcy wrote:

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.

"Dave Peterson" wrote:

So you want to see "Picture 1" all the time?

Option Explicit
Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False 'this hides all the pictures
With me.Range("A66")
For Each oPic In Me.Pictures
If lcase(oPic.Name) = lcase("Picture 1") Then
'show it
oPic.visible = true
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

chrstrcy wrote:

Here is my code:

Option Explicit

Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
With Range("A66")
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
End If '
Next oPic
End With
End Sub

"chrstrcy" wrote:

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.

"Dave Peterson" wrote:

Did you change the name of the picture in the code?

chrstrcy wrote:

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!

"Dave Peterson" wrote:

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


Newbeetle wrote:

Hi I love this, would there be a way of altering the code so that it does not
effect one chosen picture, the reason for this is I always want one picture
to be visible at all times as its a logo.

"Dave Peterson" wrote:

Maybe you could do something like JE McGimpsey does at:
http://www.mcgimpsey.com/excel/lookuppics.html

PACF wrote:

Can I include a picture in a formula i.e. if cell a26 90% then show picture
x, if less then show picture y?...

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson