I'm trying to add a hyperlink to a cell based on a user's copy-paste of the hyperlink into a userform. It keeps only linking back to my sheet,?

Viewed 23

Like the title suggests, I've created a userform with input fields for requests to buy things. Name, Item, Justification, Price, and Link are all text fields on this form. Then, when the user submits the info, it flows into the table on the sheet.

    Sub Submit()

        Dim ws As Worksheet
        Dim result As VbMsgBoxResult

        
        With Sheets("Unfunded Requests - OSA")
            .Rows(10).EntireRow.Insert
            .Range("I10").Value = UFRForm.txtName
            .Range("J10").Value = UFRForm.txtItem
            .Range("K10").Value = UFRForm.txtJust
            .Range("L10").Value = UFRForm.txtCost
            .Range("L10") = Format(Range("L10"), "Currency")
            .Hyperlinks.Add Anchor:=.Range("M10"), Address:=UFRForm.txtLink.Value, SubAddress:="", TextToDisplay:=UFRForm.txtItem.Value
            .Range("H:N").WrapText = True
            .Range("H:N").HorizontalAlignment = xlCenter
            .Columns.AutoFit
            .Rows.AutoFit
        End With
    

        result = MsgBox("Information Submitted.  Submit another request?", vbYesNo, "Confirmation")
            If result = vbYes Then
                Call Reset
            Else
                Call ExitForm
            End If
    End Sub

The link goes into the cell, but it only links back to the workbook that I'm on, and doesn't show at all the URL that the user copies and pastes into the userform. I've tried to select the cell and insert the hyperlink, I've tried to separately insert the hyperlink outside of the 'with' group, etc.

Update - I tried to change the procedure to only place the value from the userform field into the cell, and it won't even do that. Nothing I place in the userform enters that cell. I can type in the field if I want, but from the userform, it won't make it. I tried .range("M10").Value = UFRForm.txtLink. I've checked the name of the field on the userform and that's it.

0 Answers
Related