Hey,
I have a big workbook that runs alot of scripts etc so to make my life easier i have a compilation with all the sheetnames (and the data on the sheets in a more simple way) in my workbook,
Now i was planning that instead of scrolling through 100's on sheets to find the specific one i wanted to do a vba that made my compilation into hyperlinks to the right sheet.
Im sending a small xls file to show what i mean.
in "sheet2" i have a button, and when i click on it i want all the numbers in my "A column" to get linked to the right sheet (that ofcourse is already created).
for example in the dile im sending i have 5 sheets, "standard" "sheet2", "1111", "2222", "3333"
In my "a Column" in "sheet2" i have the numbers 1111,2222,3333.
And what i want is that when i click my button all the numbers get hyperlinked so that after the hyperlink is made, i can click on 1111 on "sheet2" and then i will be directed to the "1111" sheet.
I have been trying another method with this using below code but it dosent cut it real (there is some unessecery code for what i want to accomplish but its made in my real sheet where more stuff is made)
Sub Link_To_New_Worksheet()
Dim wbBook As Workbook
Dim wsSheet As Worksheet, wsInvisible As Worksheet, wsLinkFrom As Worksheet
Dim rnActive As Range
Dim strName As String
Set wbBook = ActiveWorkbook
With wbBook
Set wsInvisible = .Worksheets("Test")
Set wsLinkFrom = .Worksheets("TOC")
End With
If ActiveSheet.Name <> wsLinkFrom.Name Then
MsgBox "The TOC must be active!", vbCritical
Exit Sub
End If
With wsLinkFrom
Set rnActive = ActiveCell
End With
If rnActive.Value <> "" Then
strName = rnActive.Value
Else
MsgBox "No value was found in the active cell!", vbCritical
Exit Sub
End If
Application.ScreenUpdating = False
With wsInvisible
.Visible = xlSheetVisible
.Copy After:=wbBook.Worksheets(wbBook.Worksheets.Count)
End With
Set wsSheet = ActiveSheet
With wsSheet
.Name = strName
wsLinkFrom.Hyperlinks.Add rnActive, "", _
SubAddress:="'" & .Name & "'!A2", _
TextToDisplay:=.Name
End With
wsInvisible.Visible = xlSheetHidden
Application.ScreenUpdating = True
End Sub
Next step that i wanna do is copy/move the information in the new active sheet (like in my example above the "1111" sheet to the "standard" sheet. This is the next step tho and i havent put any time figure that one ouot yet myself tho.
Any help or hints are appriciated
Bookmarks