ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   creating hyperlink using the value of the cell (https://www.excelbanter.com/excel-programming/403709-creating-hyperlink-using-value-cell.html)

Diesel

creating hyperlink using the value of the cell
 
Hi there

i have a workbook that has a table of contents leading to seperate
worksheets.

on this contents page there are 3 columns that have the names of these pages
in and update automaticly. however i've found that although on my home pc
the hyperlinks changed as the page names changed, the pc at work this dosnt
happen.

what i'd like is a macro that can look at each cell in ranges A5:A68,
F5:F68, and H5:H68 and change the hyperlink to link to the sheet named the
same as the value?

for example

in cell A5 on the page "INDEX" the cell says "example" i would like the
hyperlink to link to sheet "example" cell A12.

and so on for each cell in the 3 columns.

Many thanks in advance

Dave



GTVT06

creating hyperlink using the value of the cell
 
On Jan 5, 9:44*am, "Diesel" wrote:
Hi there

i have a workbook that has a table of contents leading to seperate
worksheets.

on this contents page there are 3 columns that have the names of these pages
in and update automaticly. however i've found that although on my home pc
the hyperlinks changed as the page names changed, the pc at work this dosnt
happen.

what i'd like is a macro that can look at each cell in ranges A5:A68,
F5:F68, and H5:H68 and change the hyperlink to link to the sheet named the
same as the value?

for example

in cell A5 on the page "INDEX" the cell says "example" i would like the
hyperlink to link to sheet "example" cell A12.

and so on for each cell in the 3 columns.

Many thanks in advance

Dave


Sub Hyperlinks
Dim i As String
Dim cell As Range
For Each cell In Range("A5:A68,F5:F68,H5:H68")
If cell.Value < "" Then
cell.Select
i = Selection.Value
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="",
SubAddress:= _
i & "!A12", TextToDisplay:=i
End If
Next cell
End Sub

Diesel

creating hyperlink using the value of the cell
 
GTVT06, your a star.

Thank you

Dave


"GTVT06" wrote in message
...
On Jan 5, 9:44 am, "Diesel" wrote:
Hi there

i have a workbook that has a table of contents leading to seperate
worksheets.

on this contents page there are 3 columns that have the names of these
pages
in and update automaticly. however i've found that although on my home pc
the hyperlinks changed as the page names changed, the pc at work this
dosnt
happen.

what i'd like is a macro that can look at each cell in ranges A5:A68,
F5:F68, and H5:H68 and change the hyperlink to link to the sheet named the
same as the value?

for example

in cell A5 on the page "INDEX" the cell says "example" i would like the
hyperlink to link to sheet "example" cell A12.

and so on for each cell in the 3 columns.

Many thanks in advance

Dave


Sub Hyperlinks
Dim i As String
Dim cell As Range
For Each cell In Range("A5:A68,F5:F68,H5:H68")
If cell.Value < "" Then
cell.Select
i = Selection.Value
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="",
SubAddress:= _
i & "!A12", TextToDisplay:=i
End If
Next cell
End Sub



GTVT06

creating hyperlink using the value of the cell
 
On Jan 5, 11:38*am, "Diesel" wrote:
GTVT06, your a star.

Thank you

Dave

"GTVT06" wrote in message

...
On Jan 5, 9:44 am, "Diesel" wrote:





Hi there


i have a workbook that has a table of contents leading to seperate
worksheets.


on this contents page there are 3 columns that have the names of these
pages
in and update automaticly. however i've found that although on my home pc
the hyperlinks changed as the page names changed, the pc at work this
dosnt
happen.


what i'd like is a macro that can look at each cell in ranges A5:A68,
F5:F68, and H5:H68 and change the hyperlink to link to the sheet named the
same as the value?


for example


in cell A5 on the page "INDEX" the cell says "example" i would like the
hyperlink to link to sheet "example" cell A12.


and so on for each cell in the 3 columns.


Many thanks in advance


Dave


Sub Hyperlinks
*Dim i As String
Dim cell As Range
* * For Each cell In Range("A5:A68,F5:F68,H5:H68")
* * If cell.Value < "" Then
* * cell.Select
* * i = Selection.Value
* * * * ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="",
SubAddress:= _
* * * * i & "!A12", TextToDisplay:=i
* * End If
* * Next cell
End Sub- Hide quoted text -

- Show quoted text -


Your Welcome. Gald I could help!


All times are GMT +1. The time now is 10:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com