Hyperlink

YOUNAN

Board Regular
Joined
Feb 10, 2015
Messages
101
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello,

in sheet 2 cells A3:A302 I have numbers ( 60001 to 60300) , which should remain untouched.

when I click on A3 sheet 2 it should direct me to sheet 3 .
and when clicking on Sheet 2 A4 it would take to sheet 4 and so on.

clicking on Sheet 2 A5 takes me to sheet 5
clicking on Sheet 2 A6 takes me to sheet 6
clicking on Sheet 2 A7 takes me to sheet 7

and so on

the data in the Sheet 1 range from A3:A500 must remain as it is.

Thanks in advance.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hey, try this:
Code:
Sub Hyperlink()
    Dim i As Long
    
    For i = 3 To ActiveWorkbook.Sheets.Count
        Sheets("Sheet2").Activate
        ActiveSheet.Hyperlinks.Add Anchor:=Cells(i, 1), Address:="", SubAddress:= _
        "'" & Worksheets(i).Name & "'!A1", TextToDisplay:=i + 59998 & ""
    Next i
    
End Sub
 
Upvote 0
Thanks for quick reply.
I opened the file, click on ALT+F11, on the left side i cjose THis workbook from Project, double click on it, entered your code, when i click on run i get the following error:

Run time error '9': subscript out of range.

Please help

Best regards
 
Upvote 0
Hello,

What is your Sheet 2 called exactly? I have assumed it to be "Sheet2"
 
Upvote 0
Hello,

Sheet 2 till sheet 302 are called 60001 to 60300.

Best Regards
 
Upvote 0
Ok so the 2nd sheet is called "60001" ? If so then:

In the code I wrote change the Sheets("Sheet2").Activate line to Sheets("60001").Activate
 
Upvote 0
Hi again,

I am very grateful for your help, you saved my day.

Best regards
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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