Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
PW11111
 
Posts: n/a
Default McGimpsey's Disappearing Pictures

Hi,

I've used the code / formula's in the below link to make pictures
appear/disappear depending on a selection made by a dropdown.

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

It works great. However, the VB code instructs all pictures on the
spreadsheet to disappear. I have pictures on the spreadsheet other than those
I need to appear/disappear.

For example if I have two pictures (PPic1 & PPic2) how do i get these to
remain visible while still allowing the formula to work.

I know i need to change/add something to the VB code - but I'm not sure
what. I've included the code below. Any help would be great.

Cheers

Phil

Private Sub Worksheet_Calculate()
Dim oPic As Picture

With Range("B5")

For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
Else
oPic.Visible = False
Exit For
End If
Next oPic
End With
End Sub
  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

One way:

Private Sub Worksheet_Calculate()
Dim oPic As Picture
With Range("B5")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
Else
oPic.Visible = oPic.Name Like "PPic[12]"
End If
Next oPic
End With
End Sub


In article ,
"PW11111" wrote:

Hi,

I've used the code / formula's in the below link to make pictures
appear/disappear depending on a selection made by a dropdown.

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

It works great. However, the VB code instructs all pictures on the
spreadsheet to disappear. I have pictures on the spreadsheet other than those
I need to appear/disappear.

For example if I have two pictures (PPic1 & PPic2) how do i get these to
remain visible while still allowing the formula to work.

I know i need to change/add something to the VB code - but I'm not sure
what. I've included the code below. Any help would be great.

Cheers

Phil

Private Sub Worksheet_Calculate()
Dim oPic As Picture

With Range("B5")

For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
Else
oPic.Visible = False
Exit For
End If
Next oPic
End With
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I reference pictures in a worksheet? mdkoskinen Excel Discussion (Misc queries) 1 October 10th 05 12:12 AM
Is it possible to use some pictures in an IF function? [email protected] Excel Worksheet Functions 1 October 4th 05 05:10 AM
Pictures in a cell. ISUTUBBS Excel Discussion (Misc queries) 2 August 18th 05 01:01 PM
Macros associated with pictures Eric Excel Discussion (Misc queries) 2 April 29th 05 10:15 PM
Viewing Pictures Nicola Excel Discussion (Misc queries) 1 December 8th 04 03:24 PM


All times are GMT +1. The time now is 12:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"