Create 100 hyperlinks at once.

rikvny02

Board Regular
Joined
Aug 9, 2022
Messages
78
Office Version
  1. 365
Platform
  1. Windows
Hi i have a master sheet with a list of around 100 Employees. Each employee has a tab with the same name. I would like to hyperlink each cell in column E to its corresponding tab. I found the code below and it looks like it should work but it is not. Any help would be greatful.

Sub Hyperlink_Sheets_Names()
Dim cell As Range, ws As Worksheet
With Sheets("OPTIONS") 'Sheet with the hyperlink sheet names
On Error Resume Next
For Each cell In .Range("e1", .Range("e" & Rows.Count).End(xlUp)) 'Loop for each used cell in column E
If cell.Value <> "" Then
Set ws = Nothing
Set ws = Sheets(cell.Value)
If Not ws Is Nothing Then
Hyperlinks.Add anchor:=cell, Address:="", SubAddress:=("'" & cell.Value & "'!a1")
End If
End If
Next cell
On Error GoTo 0
End With
End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
How about:

VBA Code:
Sub Macro1()
Dim c As Range
For Each c In Range("E1:E" & Range("E" & Rows.Count).End(xlUp).Row)
    If c.Hyperlinks.Count = 0 And c <> "" Then c.Hyperlinks.Add c, "", c & "!A1", , c.Text
Next
End Sub
 
Upvote 0
Solution
How about:

VBA Code:
Sub Macro1()
Dim c As Range
For Each c In Range("E1:E" & Range("E" & Rows.Count).End(xlUp).Row)
    If c.Hyperlinks.Count = 0 And c <> "" Then c.Hyperlinks.Add c, "", c & "!A1", , c.Text
Next
End Sub
Thank you. Your my new best friend. lol
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,951
Members
449,095
Latest member
nmaske

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