mysticmario
Active Member
- Joined
- Nov 10, 2021
- Messages
- 323
- Office Version
- 365
- Platform
- Windows
Hi I tried multiple versions of this code to create a proper hyperlink to another sheet in the same workbook:
The code works to a point where it shoudl assign address to go to
When u click the link all I get is:
I'm loosing my mind with this one
variable seen as ans2 is defined earlier in the code and works fine. In the picture u can see debug printed sheet name in cell F41 that is the exact name of the sheet I'm trying to go to.
Can anyone help?
VBA Code:
lr = Sheets("PROJEKTY ZAKOŃCZONE").Cells(Rows.Count, "F").End(xlUp).Row
Dim wb As Workbook
Set wb = ThisWorkbook
Dim adressn As String
adressn = "Godziny" + Left(ans2, 5)
Dim ws As Worksheet
Set ws = wb.Worksheets(adressn)
Sheets("PROJEKTY ZAKOŃCZONE").Cells(lr + 1, "F").Hyperlinks.add Anchor:=Sheets("PROJEKTY ZAKOŃCZONE").Cells(lr + 1, "F"), Address:="", SubAddress:="ws", TextToDisplay:="Open"
The code works to a point where it shoudl assign address to go to
When u click the link all I get is:
I'm loosing my mind with this one
variable seen as ans2 is defined earlier in the code and works fine. In the picture u can see debug printed sheet name in cell F41 that is the exact name of the sheet I'm trying to go to.
Can anyone help?