How to Link a hyperlink'd text to another button while button and hyperlink'd text are in same cell

Ansys_Excel

New Member
Joined
Nov 6, 2013
Messages
1
1. I have a text "test" in cell "A1" in "sheet1" which is hyperlink'd to a hidden sheet "sheet2". I have sheet code sub in "sheet1" "worksheet_followhyperlink" which allows me to click the text "test" to unhide & select "sheet2".
2. I have created a button on top of hyperlink'd text "test" in sheet1 cell"A1", it has its own name & caption. I have created 2nd sub "button_click" in "sheet1" & pressing button basically to call sub "worksheet_followhyperlink" . I am getting error upon pressing the button as "complie error: Argument not optional". Pls advise how to assign button to hyperlink button so that once I press the button should make hyperlink text to work which is in same cell as button.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi and welcome to the forum.

Try something like this for the CommandButton_Click procedure.

Code:
[color=darkblue]Private[/color] [color=darkblue]Sub[/color] CommandButton1_Click()
    [color=darkblue]With[/color] Range("A1")
        Worksheet_FollowHyperlink .Hyperlinks(1)
        .Hyperlinks(1).Follow
    [color=darkblue]End[/color] [color=darkblue]With[/color]
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
 
Upvote 0

Forum statistics

Threads
1,215,521
Messages
6,125,305
Members
449,218
Latest member
Excel Master

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