PC Review


Reply
Thread Tools Rate Thread

Change pictures in Excel?

 
 
petterss
Guest
Posts: n/a
 
      2nd Aug 2006

Hi!
I want to change a picture depending of a choice in a cell!
EX: In D3 I have a list (dog, cat and bird) and I want to show a
picture of the choice beside the list!
Can I do that

Thanks !


--
petterss
------------------------------------------------------------------------
petterss's Profile: http://www.excelforum.com/member.php...o&userid=36354
View this thread: http://www.excelforum.com/showthread...hreadid=567363

 
Reply With Quote
 
 
 
 
Ken Johnson
Guest
Posts: n/a
 
      2nd Aug 2006
Hi peterss,

Check out John McGimpsey's site...

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

Ken Johnson

 
Reply With Quote
 
 
 
 
petterss
Guest
Posts: n/a
 
      11th Aug 2006

Ken Johnson Wrote:
> Hi peterss,
>
> Check out John McGimpsey's site...
>
> http://www.mcgimpsey.com/excel/lookuppics.html
>
> Ken Johnson



Hi !
I want to show a picture depending of a choice in a specific cell.
have asked before and I get a link to some exempel, the problem is tha
a get an error message and I dont now what to do (Im a amateur!).

The link was: http://www.mcgimpsey.com/excel/lookuppics.html

I copy the code to my file, but I get an "error 13 - miss match" al
the time.
Code:
Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = True
With Range("B41")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
Exit For
End If
Next oPic
End With
End Sub

"oPic.Name" never get the same like ".Text", my pictures have name
like 212,213... but "oPic.Name" is like 103,104...
So when it comes to "Next oPic" it stops!

What should I do? Where is the pictures defind? Whats "Me.Pictures"?

Thank

--
petters
-----------------------------------------------------------------------
petterss's Profile: http://www.excelforum.com/member.php...fo&userid=3635
View this thread: http://www.excelforum.com/showthread.php?threadid=56736

 
Reply With Quote
 
New Member
Join Date: Nov 2007
Posts: 1
 
      8th Nov 2007
I came accross a similar problem with the script, it seems to happen if you have "things" on your spreadsheet which are recorded in Me.Pictures but are not acutally pictures; buttons, listboxes etc...

You need to specifically list your pictures, make them invisible, then I used an IF statement to look at the cell containing the picture name and display the relevant pic. Like this:

Private Sub Worksheet_Calculate()
Dim x As Integer
Dim Pics(9) As String 'Holds all the pic names

'Picture 1 and 2 are a listbox and a button, so I want these visible
Sheets(1).Shapes("Picture 1").Visible = True
Sheets(1).Shapes("Picture 2").Visible = True

'These are my pics that I want to hide and display
Sheets(1).Shapes("Picture 3").Visible = False
Sheets(1).Shapes("Picture 4").Visible = False
Sheets(1).Shapes("Picture 5").Visible = False
Sheets(1).Shapes("Picture 6").Visible = False
Sheets(1).Shapes("Picture 7").Visible = False
Sheets(1).Shapes("Picture 8").Visible = False
Sheets(1).Shapes("Picture 9").Visible = False
Sheets(1).Shapes("Picture 10").Visible = False
Sheets(1).Shapes("Picture 11").Visible = False
Sheets(1).Shapes("Picture 12").Visible = False

'Fill the array with your pic names
Pics(0) = "Picture 3"
Pics(1) = "Picture 4"
Pics(2) = "Picture 5"
Pics(3) = "Picture 6"
Pics(4) = "Picture 7"
Pics(5) = "Picture 8"
Pics(6) = "Picture 9"
Pics(7) = "Picture 10"
Pics(8) = "Picture 11"
Pics(9) = "Picture 12"
x = 0

With Range("K1") 'K1 is where I want my pic displayed

Do While x <= 9 'Read and match the contents with your pic
If .Text = Pics(x) Then
Sheets(1).Shapes(Pics(x)).Visible = True
Sheets(1).Shapes(Pics(x)).Top = .Top
Sheets(1).Shapes(Pics(x)).Left = .Left

End If
x = x + 1

Loop
End With

End Sub

Hope this helps,
Matt
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thumbnails of pictures in the My Pictures tab change to icons after emailing sjkline@chartermi.net Windows XP Help 5 8th Jul 2007 02:10 AM
No pictures found in My Pictures by My Pictures Screensaver =?Utf-8?B?R2Vvcmdl?= Windows XP Photos 5 2nd Oct 2004 08:39 PM
"My Pictures" folder shows up as "Michael's Pictures" Michael Golden Windows XP Security 8 22nd Jan 2004 03:53 AM
Deleting Pictures from My Pictures =?Utf-8?B?QXJ0?= Windows XP Help 0 4th Jan 2004 10:36 PM
"Shared Pictures" folder shows up as "My Pictures" Bruce Forstall Windows XP Help 4 4th Dec 2003 04:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:41 AM.