Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Add a picture to a cell that only appears on click

I want to add a picture to a cell that will appear when the user clicks on
the "picture" cell. For example, a list of parts, that shows the picture of
the part when it is clicked on.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Add a picture to a cell that only appears on click

I assume you have already named your pictures as the part number as in th
"picture cells"

Try the following in the sheet module (rt-click sheet tab, view code).
Change C3:C11 to the range of your picture cells, a named range perhaps.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim pic As Picture
On Error GoTo errExit
Me.Pictures.Visible = False
If Not Intersect(Range("C3:C11"), Target(1)) Is Nothing Then
Set pic = Me.Rectangles(Target(1).Value)
If Not pic Is Nothing Then
With Target(1)
pic.Left = .Left + .Width - 2
pic.Top = .Top + 2
pic.Visible = True
End With
End If
End If
errExit:
End Sub

Regards,
Peter T



"mikef255" wrote in message
...
I want to add a picture to a cell that will appear when the user clicks on
the "picture" cell. For example, a list of parts, that shows the picture
of
the part when it is clicked on.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Add a picture to a cell that only appears on click



"Peter T" wrote:

I assume you have already named your pictures as the part number as in th
"picture cells"

Try the following in the sheet module (rt-click sheet tab, view code).
Change C3:C11 to the range of your picture cells, a named range perhaps.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim pic As Picture
On Error GoTo errExit
Me.Pictures.Visible = False
If Not Intersect(Range("C3:C11"), Target(1)) Is Nothing Then
Set pic = Me.Rectangles(Target(1).Value)
If Not pic Is Nothing Then
With Target(1)
pic.Left = .Left + .Width - 2
pic.Top = .Top + 2
pic.Visible = True
End With
End If
End If
errExit:
End Sub

Regards,
Peter T



"mikef255" wrote in message
...
I want to add a picture to a cell that will appear when the user clicks on
the "picture" cell. For example, a list of parts, that shows the picture
of
the part when it is clicked on.



Thanks Peter, That worked perfect!!!

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 pdf picture appears when copying and pasting one sheet to anot farooq Excel Discussion (Misc queries) 0 September 25th 06 08:44 PM
Upon mouse click a checkmark appears in a square. rbbbbeee Excel Programming 1 August 16th 06 06:56 AM
Disabling click and right-click on the Picture I inserted in an Excel document [email protected] Excel Worksheet Functions 1 June 2nd 06 09:13 PM
'Unprotect' dialog box appears on every click danmahoney Excel Discussion (Misc queries) 0 February 15th 06 03:58 PM
insert a picture into a comment box so that it appears/hides simi. Maxwell Excel Discussion (Misc queries) 2 March 24th 05 05:06 PM


All times are GMT +1. The time now is 07:42 AM.

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

About Us

"It's about Microsoft Excel"