Go Back   Trackpads Community > General Discussions > Computer and Technology > Microsoft Applications

Microsoft Applications Discussions about Windows and other MS Products such as Office

Reply
 
LinkBack Thread Tools
Old 06-16-2004, 04:01   #1 (permalink)
gatesheadthunde
Civilians

 
Default Click on a link and a picture loads in cell depending on which link you have clicked

Hello

If I have five links in cells A1:A5 with peoples names. How can I
get...

e.g.

If I click on Bill in A2 then a picture of Bill loads in cell D1 and
then click Mark and a picture of Mark loads in D1.

Thanks in advance


---
Message posted from http://www.ExcelForum.com/

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 06-16-2004, 04:01   #2 (permalink)
Dave Peterson
Civilians

 
Default Re: Click on a link and a picture loads in cell depending on which linkyou have clicked

I'm not sure what you mean by link in A1 through A5, but I'd try it this way:

Put all 5 pictures on the worksheet and position them where you want them.

Name them to match the values in A1:A5.
Select the picture for Bill and then type Bill in the name box (to the left of
the formulabar) and hit enter.

After all 5 pictures are named nicely and positioned correctly, right click on
the worksheet tab that needs this behavior. Select view code and past this in.
Then back to excel and test it out.

It actually doesn't depend on a click--just select the cell (a1:a5) that you
want to show.

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim myPictNames As Variant
Dim iCtr As Long

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("A1:A5")) Is Nothing Then Exit Sub

myPictNames = Array("bill", "jim", "mark", "mary", "peo")

On Error Resume Next
For iCtr = LBound(myPictNames) To UBound(myPictNames)
Me.Pictures(myPictNames(iCtr)).Visible = False
Next iCtr
Me.Pictures(Target.Value).Visible = True
On Error GoTo 0

End Sub

I've pretty much thrown any error checking away with that "on error resume next"
statement. So be careful when you set it up.

"gatesheadthunde <" wrote:
>
> Hello
>
> If I have five links in cells A1:A5 with peoples names. How can I
> get...
>
> e.g.
>
> If I click on Bill in A2 then a picture of Bill loads in cell D1 and
> then click Mark and a picture of Mark loads in D1.
>
> Thanks in advance
>
> ---
> Message posted from http://www.ExcelForum.com/


--

Dave Peterson
ec35720@msn.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-16-2004, 04:04   #3 (permalink)
gatesheadthunde
Civilians

 
Default Re: Re: Click on a link and a picture loads in cell depending on which link

Thanks for that but I am still unable to get this to work...

'A link to my project'
(http://www.geocities.com/gateshead_t...ictureTest.xls)

The above link is the worksheet I want to use it for. I have a drop
down list now showing some Premiership clubs. With that I have used
VLOOKUP to display the selected teams stadium name.

However, what I want is for a picture of the stadium to appear where
the box.

Thanks


---
Message posted from http://www.ExcelForum.com/

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-16-2004, 04:04   #4 (permalink)
Dave Peterson
Civilians

 
Default Re: Click on a link and a picture loads in cell depending on which link

I don't open attachments or links to files.

If your dropdown list is created via data|validation and you're using xl97, then
the worksheet event won't fire.

You could put a button near the dropdown to show/hide the pictures.

"gatesheadthunde <" wrote:
>
> Thanks for that but I am still unable to get this to work...
>
> 'A link to my project'
> (http://www.geocities.com/gateshead_t...ictureTest.xls)
>
> The above link is the worksheet I want to use it for. I have a drop
> down list now showing some Premiership clubs. With that I have used
> VLOOKUP to display the selected teams stadium name.
>
> However, what I want is for a picture of the stadium to appear where
> the box.
>
> Thanks
>
> ---
> Message posted from http://www.ExcelForum.com/


--

Dave Peterson
ec35720@msn.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-16-2004, 04:04   #5 (permalink)
gatesheadthunde
Civilians

 
Default Re: Re: Click on a link and a picture loads in cell depending on which link

Dave,

I have managed to get this to work now, thank you.

On problem however... after selecting the name from the drop down list
the cell with Stadium name automatically changes and the picture only
shows when that cell is selected. Is there anyway to get it too show
instantly?

Thanks


---
Message posted from http://www.ExcelForum.com/

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-16-2004, 04:04   #6 (permalink)
Dave Peterson
Civilians

 
Default Re: Click on a link and a picture loads in cell depending on which link

What version of excel are you using?

With xl2k or higher, you can use a worksheet change event--I'd toss the version
based on selection:

It sounds like you changed from A1:A5 to just one cell, though. I used A1 in
this code:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myPictNames As Variant
Dim iCtr As Long

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub

myPictNames = Array("bill", "jim", "mark", "mary", "peo")

On Error Resume Next
For iCtr = LBound(myPictNames) To UBound(myPictNames)
Me.Pictures(myPictNames(iCtr)).Visible = False
Next iCtr
Me.Pictures(Target.Value).Visible = True
On Error GoTo 0

End Sub


But if you're using xl97, this note from Debra Dalgleish's site may apply
http://www.contextures.com/xlDataVal08.html:

In Excel 97, selecting an item from a Data Validation dropdown list
does not trigger a Change event, unless the list items have been typed in
the Data Validation dialog box. In this version, you can add a button to
the worksheet, and run the code by clicking the button. To see an
example, go to the Sample Worksheets page, and under the Filters
heading, find Product List by Category, and download the
ProductsList97.xls file.



"gatesheadthunde <" wrote:
>
> Dave,
>
> I have managed to get this to work now, thank you.
>
> On problem however... after selecting the name from the drop down list
> the cell with Stadium name automatically changes and the picture only
> shows when that cell is selected. Is there anyway to get it too show
> instantly?
>
> Thanks
>
> ---
> Message posted from http://www.ExcelForum.com/


--

Dave Peterson
ec35720@msn.com
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-16-2004, 04:04   #7 (permalink)
gatesheadthunde
Civilians

 
Default Re: Re: Click on a link and a picture loads in cell depending on which link

That formula worked perfect.

Thank you very much.




---
Message posted from http://www.ExcelForum.com/

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Link a picture schnett Microsoft Applications 2 02-16-2005 16:00
Insert picture with link Peter Janssens Microsoft Applications 1 02-07-2005 16:00
link access to powerpoint. right click/drag isn't working for me. =?Utf-8?B?YnJpdHRvbnNhbmR5Z2lybA==?= Microsoft Applications 1 11-23-2004 19:00
Created MS Project to Link subproject (1-354, where 1=Link projec. =?Utf-8?B?TUFSMTExNA==?= Microsoft Applications 1 11-15-2004 16:00
Control Cell Link for Option Button based on value in a cell arunjoshi Microsoft Applications 1 06-16-2004 02:20


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 13:28.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 1.34566 seconds with 19 queries