ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hyperlink target should equal parent (https://www.excelbanter.com/excel-programming/337137-hyperlink-target-should-equal-parent.html)

Peanut_1999

Hyperlink target should equal parent
 
Hi

I set up a successful spreadsheet using hyperlinks on a 'league table'.
When activated the hyperlink takes you to another spreadsheet within
the workbook and populates the target cell with the name from the
original hyperlink cell. I then have lookup formulae within a table
below to show all perfomance criteria / achievement for the person
selected from the 'league table'.

The macro I used is:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim source_value
Dim varsplit
source_value = Target.Parent.Value
varsplit = Split(Target.SubAddress, "!")
Worksheets(varsplit(0)).Range(varsplit(1)).Value = source_value
End Sub

(which I copied from one of these topics)

However, I have amended the spreadsheet to incorporate new people and
re-vamped it a bit but now the macro doesn't seem to work. Apart from
peoples names and formatting, there isn't much difference.

One of the things I've changed is using shapes with hyperlinks as page
selecting buttons instead of ordinary rectangular buttons with code.
Could this be the cause?

I'm pretty useless at this kind of thing and have learnt all that I
know from asking questions, so please go easy on the technical
language.

Many Thanks
Peanut


okaizawa

Hyperlink target should equal parent
 
Hi,

testing in excel 2000 on my pc, a shape with hyperlink seems not to fire
the event. (and, not to run the macro assigned to it)

how about setting a hyperlink in the cell that lies under the upper-left
corner of the shape, and assigning a macro to the shape, like this:

'shape's name needs to be unique on the sheet.

Sub HyperlinksShape_Click()
ActiveSheet.Shapes(Application.Caller).TopLeftCell .Hyperlinks(1).Follow
End Sub

--
HTH,

okaizawa


Peanut_1999 wrote:
Hi

I set up a successful spreadsheet using hyperlinks on a 'league table'.
When activated the hyperlink takes you to another spreadsheet within
the workbook and populates the target cell with the name from the
original hyperlink cell. I then have lookup formulae within a table
below to show all perfomance criteria / achievement for the person
selected from the 'league table'.

The macro I used is:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim source_value
Dim varsplit
source_value = Target.Parent.Value
varsplit = Split(Target.SubAddress, "!")
Worksheets(varsplit(0)).Range(varsplit(1)).Value = source_value
End Sub

(which I copied from one of these topics)

However, I have amended the spreadsheet to incorporate new people and
re-vamped it a bit but now the macro doesn't seem to work. Apart from
peoples names and formatting, there isn't much difference.

One of the things I've changed is using shapes with hyperlinks as page
selecting buttons instead of ordinary rectangular buttons with code.
Could this be the cause?

I'm pretty useless at this kind of thing and have learnt all that I
know from asking questions, so please go easy on the technical
language.

Many Thanks
Peanut



All times are GMT +1. The time now is 07:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com