Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I reference pictures in a worksheet? | Excel Discussion (Misc queries) | |||
Is it possible to use some pictures in an IF function? | Excel Worksheet Functions | |||
Pictures in a cell. | Excel Discussion (Misc queries) | |||
Macros associated with pictures | Excel Discussion (Misc queries) | |||
Viewing Pictures | Excel Discussion (Misc queries) |