Space in Sheet Title causing Reference Not Valid for Hyperlink

lakomitten11

New Member
Joined
Jun 21, 2017
Messages
7
The purpose of this code is to create a hyperlink to another sheet based off of the 'Equipment Name' variable which is the last value in the equipment list.
The code is creating the hyperlink properly, however when there is a space in the equipment name I will receive a Reference Not Valid error, then the sheet will open.


Code:
    Dim R As Range
    Set R = Cells(Rows.Count, 2).End(xlUp) 'last cell in Column B with data
    If Len(R.Value) > 0 Then Set R = R.Offset(1)
    R.Value = Range("j3").Value


       HyperlinkName = Sheet4.Range("j3").Value


    Sheets("Equipment List").Hyperlinks.Add Anchor:=R, Address:="", SubAddress:= _
    HyperlinkName & "!A1", TextToDisplay:=HyperlinkName
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,215,091
Messages
6,123,062
Members
449,090
Latest member
fragment

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