using Hyperlinks Podcast #1729 produces an ERROR on the 1st Woksheets line, why?

Raymond1

New Member
Joined
Dec 1, 2015
Messages
36
using a horizontal list entitled "Training2019" with hyperlinks to 3 hidden worksheets using code:

Private Sub Worksheet_FollowHyperlink (ByVal Target As Hyperlink)
LinkTo = Target.SubAddress
WhereBang = InStr(1, LinkTo, "!")
If WhereBang > 0 Then
MySheet = Left(LinkTo, WhereBang-1)
Worksheets (MySheet).Visibe = True **ERROR Here
Worksheets (MySheet).Select
MyAddr = Mid(LinkTo, WhereBang + 1)
Worksheets(mySheet).Rang(MyAddr).Select
EndIf
End Sub


each sheet also has the following code:
Private Sub Worksheet_FollowHyperlink(ByVal Tareget A Hyperlink)
Worksheets ("Training2019").Select
Target.Parent.Worksheet.Visible = False
End Sub

what am I doing wrong?
 
Last edited:
That means that more than likely there is something wrong with the sheetname. Check that mySheet exactly matches your sheets name including any leading/trailing spaces.

If that exactly matches then you will have to do the same with MyAddr.

Edit: not sure what you are saying with your last posts.
 
Last edited:
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
The error you are getting would still imply that there is something wrong with the sheetname (it must be exact including the spaces) or the range. Use Debug.Print to see exactly what mySheet is producing.
 
Upvote 0
Another thought, are any of your sheet names purely numeric (ie 15 or 22)?
 
Upvote 0
What is the value of "MySheet" when you get the error? and are you sure that you have a sheet with that Exact name?
 
Upvote 0
the value is "TIG Training" (ie. the label of 1 of my 3 sheets); the name of my Master Sheet is "Training2019" .... just a thought, would the file extension .xlsb have anything to do, or perhaps I am missing a step after I hit "RUN"
 
Upvote 0
Unhide & Select the "TIG Training" sheet, then run this code
Code:
Sub chk()
Debug.Print "|" & ActiveSheet.Name & "|", Len(ActiveSheet.Name)
End Sub
Look in the Immediate window, below the main code window (Ctrl G will bring it up if not visible) & paste what is in there to the thread
 
Upvote 0
|TIG Training| 12
|TIG Training| 12
|TIG Training| 12
|TIG Training| 12
|TIG Training| 12
|TIG Training| 12
 
Upvote 0
Ok, it's because you sheet has spaces in the name.
With your code MySheet will return 'TIG Training' rather than TIG Training.
Do all you sheets have spaces in the name?
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,191
Members
453,021
Latest member
pingpong7117

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