Edit hyperlinks

Brian from Maui

MrExcel MVP
Joined
Feb 16, 2002
Messages
8,459
Aloha,

I renamed my worksheets in a workbook not realizing that it breaks the hyperlinks. I tried using "replace" but that does not seem to work. I can't rename the the sheets, as I have other formulas with the new worksheet names. Anyone have any ideas, besides doing it one by one?

Brian
 
Reggie
i'm not quite sure what you mean, but this macro will search the workbook for names and will make a hyperlink to each name in 1. worksheet column A

Sub MakelinksToName()
For Each n In ActiveWorkbook.Names
x = x + 1
Sheets(1).Hyperlinks.Add Anchor:=Cells(x, 1), Address:="", SubAddress:= _
n.Name
Next
End Sub

regards Tommy
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Reggie
This macro will limit the names to those on sheet 2

Sub MakelinksToName()
For Each n In ActiveWorkbook.Names
If InStr(1, n.RefersTo, Sheets(2).Name) Then
x = x + 1
Sheets(1).Hyperlinks.Add Anchor:=Cells(x, 1), Address:="", SubAddress:= _
n.Name
End If
Next
End Sub
 
Upvote 0
Thankyou Tommy. Works well.

I was wondering if this coding can be modified so that it limits the creation of hyperlinks to names located in a particular column in sheet 2? My sheet has many hundreds of names and limiting to a particular row would be helpful.

Thankyou again very much for your help.
 
Upvote 0
Hi Reggie
Modified code. Run this while being on sheet 1. This will ask you for a column. Just point to sheet 2 and a select a cell in the column you want to list hyperlinks for.


Sub MakelinksToName()
Dim c As Range
Set c = Application.InputBox("Which column ?", , , , , , , :cool:
col = c.Column
For Each n In ActiveWorkbook.Names
If InStr(1, n.RefersTo, Sheets(2).Name) Then
Set t = Range(Mid(n.RefersTo, Len(Sheets(2).Name) + 3))
If t.Column = col Then
x = x + 1
Sheets(1).Hyperlinks.Add Anchor:=Cells(x, 1), Address:="", SubAddress:= _
n.Name
End If
End If
Next
End Sub

regards Tommy
 
Upvote 0

Forum statistics

Threads
1,214,650
Messages
6,120,734
Members
448,987
Latest member
marion_davis

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