VBA create hyperlink for a shape

comando_sur

New Member
Joined
Sep 6, 2016
Messages
12
In a spreadsheet I'm using shapes to act as buttons, I would like that once clicked go to the location on the correct sheet using a hyperlink and be on the top.

For text I can use the below however for shapes I can't find how to create a hyperlink using a macro.

Code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    ActiveWindow.ScrollRow = ActiveCell.Row -1
End Sub



The code I would need is to set a hyperlink from shape called "shape_total" and show in the top of the spreadsheet the Defined Names (located on Edit hyperlink) : Total_Month

Thanks in advance
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Why must you use a Hyperlink?

Tell me when you click on the shape what do you want to happen.
And do not say follow Hyperlink

Just say what you want the end result to be.
 
Upvote 0
Put this script in your button:

This script will take you to a sheet name "Me" Range("K45")

Modify to your needs


Code:
Sub Go_Home()
Application.Goto Reference:=Worksheets("Me").Range("K45"), Scroll:=True
        With ActiveWindow
            i = .VisibleRange.Rows.Count / 2
            j = .VisibleRange.Columns.Count / 2
            .SmallScroll Up:=i, ToLeft:=j
        End With
End Sub
 
Upvote 0
The code work fine to go a specific range or cell, however as i'm using tables that the number of row is variable and the position of the hyperlinked Defined Names change, I would like a code that automatically pick up the hyperlinked shape and once found put this on the top


Hope this make sense




 
Upvote 0
Two things I do not understand:

You said:
"the position of the hyperlinked Defined Names"

What is a Hyperlinked Defined Name ?

And you never answered this question:

"Tell me when you click on the shape what do you want to happen."

See I think instead of you telling me what you want to happen your telling me how you want to do this.

But that's OK. I do not know how to do what you may be wanting to do "the way you want it done"

And you said:
"and once found put this on the top"

What is "this" and what is "top" ?
 
Upvote 0
You said: "the position of the hyperlinked Defined Names", What is a Hyperlinked Defined Name ?
R: is the cell, range of cells, or nonadjacent selections that you want to name or has been named on my case .i.e: Total_Month


And you never answered this question: "Tell me when you click on the shape what do you want to happen."
R: Once the shape is clicked go to the named hyperlink on the spreadsheet which is on a variable position or cell


And you said: What is "this" and what is "top" ?
R: when I used the phrase 'this' I was referring to the shape and "top" means top of the spreadsheet


I would like something similar to the below query but rather than use hyperlinked text (the below code only work with text) use shapes or buttons

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
ActiveWindow.ScrollRow = ActiveCell.Row -1
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top