Hello!
I'm struggling to get it right, but whatever I try, I can't make it work.
I have a table in which I need to make every cell in first column as a link to a worksheet of the same name that is inside the cell.
(that is: cells in 1st column is 1:1 a list of worksheets, excluding worksheet #1 which is a table of contents named "Zestawienie" with some details)
I tried this one:
but get error when hyperlink is about to be added.
This one doesn't work either:
I don't know how to put variable WorkSheet name as subaddress for hyperlink inside a cell.
As far as I know Anchor tells VBA which cell will be an active link, Address is required only if it's external link (empty if not) and Subaddress is a name of target worksheet and range (presumably A1).
This code recorded by macro recorder obviously works, but it has constant worksheet name here (BodyFit), which I need to be a variable:
Thank you in advance for all your help!
I'm struggling to get it right, but whatever I try, I can't make it work.
I have a table in which I need to make every cell in first column as a link to a worksheet of the same name that is inside the cell.
(that is: cells in 1st column is 1:1 a list of worksheets, excluding worksheet #1 which is a table of contents named "Zestawienie" with some details)
I tried this one:
Code:
Dim wZestawieniu As Integer
Dim ArkuszDocelowy As Range
wZestawieniu = 2
Do Until Cells(wZestawieniu, 1).Value = ""
Set ArkuszDocelowy = Worksheets(wZestawieniu).Cells(1, 1)
Sheets("ZESTAWIENIE").Hyperlinks.Add Anchor:=Cells(wZestawieniu, 1), Address:="", SubAddress:=ArkuszDocelowy
wZestawieniu = wZestawieniu + 1
Loop
This one doesn't work either:
Code:
Dim WS As Worksheet
Dim wZestawieniu As Integer
Dim ArkuszDocelowy As Range
For Each WS In ActiveWorkbook.Worksheets
Sheets("ZESTAWIENIE").Hyperlinks.Add Anchor:=Cells(wZestawieniu, 1), Address:="", SubAddress:=Chr(34) & Chr(39) & WS.Name & Chr(39) & "A1" & Chr(34)
wZestawieniu = wZestawieniu + 1
Next
I don't know how to put variable WorkSheet name as subaddress for hyperlink inside a cell.
As far as I know Anchor tells VBA which cell will be an active link, Address is required only if it's external link (empty if not) and Subaddress is a name of target worksheet and range (presumably A1).
This code recorded by macro recorder obviously works, but it has constant worksheet name here (BodyFit), which I need to be a variable:
Code:
Range("A3").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"'Bodyfit'!A1"
Thank you in advance for all your help!