PC Review


Reply
Thread Tools Rate Thread

Add a picture to a cell that only appears on click

 
 
mikef255
Guest
Posts: n/a
 
      9th Apr 2009
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.
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      9th Apr 2009
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" <(E-Mail Removed)> wrote in message
news:98DAD572-F2E3-4C7A-A39B-(E-Mail Removed)...
>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.



 
Reply With Quote
 
mikef255
Guest
Posts: n/a
 
      9th Apr 2009


"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" <(E-Mail Removed)> wrote in message
> news:98DAD572-F2E3-4C7A-A39B-(E-Mail Removed)...
> >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 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
Blue box appears when I click cell aronukmale Microsoft Access Queries 1 15th Nov 2008 10:21 PM
Disabling click and right-click on the Picture I inserted in an Excel document shettyna@yahoo.com Microsoft Excel Worksheet Functions 1 2nd Jun 2006 09:13 PM
Inserting a picture but the only a box appears and no picture =?Utf-8?B?cG9wZXll?= Microsoft Access 2 8th Nov 2005 04:36 PM
In excel when click on a cell cursor locks and blue area appears. =?Utf-8?B?Um9nZXI=?= Microsoft Excel Crashes 0 22nd Feb 2005 02:17 PM
Click on a link and a picture loads in cell depending on which link you have clicked gatesheadthunde Microsoft Excel Discussion 7 13th Jun 2004 03:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:59 AM.