FlavorFlav
New Member
- Joined
- Mar 29, 2023
- Messages
- 4
- Office Version
- 365
- Platform
- Windows
Hi all!
I was really happy that I finally were able to manage UserForms properly, but in the end there was still a problem
UseCase: The user can click on a button & then input the data (hyperlink, Description, Text to display). This hyperlink is then shortly checked with an URL existance function, which works great.
However, everything works but when I then try to open the added Hyperlink in the Excel, it does not work at all... Can somebody help me there and show me where the mistake is?
Step 1: Click on Button
Step 2: User Form appears & link is tested with an URL existance function:
Step 3: "Link", "Text to Show" & "Description" is added to the Excel table (See screenshot 1). The user should then click on the link in Excel & open the link. But if I hoover then over the link in the Excel the following is shown & by clicking on it, it appers the error message below.
The code is the following:
Sub Button_New_Click()
Dim LastRow As Integer
Dim IsEmpty1, IsEmpty2 As Boolean
Range("T_Links_" & ActiveSheet.Range("B3")).Select 'Refers to table Name with links on the corresponding project
IsEmpty1 = IsEmpty(Selection.Cells(1, 1))
IsEmpty2 = IsEmpty(Selection.Cells(2, 1))
If IsEmpty1 = False Then 'to check if first cell is filled with data in Links-Table
If IsEmpty2 = False Then 'to check if second cell is filled with data in Links-Table (if only first is filled, still an adjustment needed)
LastRow = Selection.End(xlDown).Row + 1
Else
LastRow = Selection.Cells(2, 1).Row
End If
Else
LastRow = Selection.Cells(1, 1).Row
End If
Range("A" & LastRow).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=Input_Hyperlink.Value, TextToDisplay:=Input_TextShow.Value
Selection.Offset(0, 1).Value = Input_Description
Unload Me
End Sub
If I use the "Immediate Window" , it shows me that "Input_Hyperlink" is a String & also that "Input_Hyperlink.Value" = "www.google.com" , but in the Excel itself it shows then not "www.google.com" but instead a longer text as shown in the screenshot above, which results in an error message...
Any ideas why this error appears?
Thanks in advance!
I was really happy that I finally were able to manage UserForms properly, but in the end there was still a problem
UseCase: The user can click on a button & then input the data (hyperlink, Description, Text to display). This hyperlink is then shortly checked with an URL existance function, which works great.
However, everything works but when I then try to open the added Hyperlink in the Excel, it does not work at all... Can somebody help me there and show me where the mistake is?
Step 1: Click on Button
Step 2: User Form appears & link is tested with an URL existance function:
Step 3: "Link", "Text to Show" & "Description" is added to the Excel table (See screenshot 1). The user should then click on the link in Excel & open the link. But if I hoover then over the link in the Excel the following is shown & by clicking on it, it appers the error message below.
The code is the following:
Sub Button_New_Click()
Dim LastRow As Integer
Dim IsEmpty1, IsEmpty2 As Boolean
Range("T_Links_" & ActiveSheet.Range("B3")).Select 'Refers to table Name with links on the corresponding project
IsEmpty1 = IsEmpty(Selection.Cells(1, 1))
IsEmpty2 = IsEmpty(Selection.Cells(2, 1))
If IsEmpty1 = False Then 'to check if first cell is filled with data in Links-Table
If IsEmpty2 = False Then 'to check if second cell is filled with data in Links-Table (if only first is filled, still an adjustment needed)
LastRow = Selection.End(xlDown).Row + 1
Else
LastRow = Selection.Cells(2, 1).Row
End If
Else
LastRow = Selection.Cells(1, 1).Row
End If
Range("A" & LastRow).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=Input_Hyperlink.Value, TextToDisplay:=Input_TextShow.Value
Selection.Offset(0, 1).Value = Input_Description
Unload Me
End Sub
If I use the "Immediate Window" , it shows me that "Input_Hyperlink" is a String & also that "Input_Hyperlink.Value" = "www.google.com" , but in the Excel itself it shows then not "www.google.com" but instead a longer text as shown in the screenshot above, which results in an error message...
Any ideas why this error appears?
Thanks in advance!