'How to add a popup to add a hyperlink to a cell in Excel?
I am new to Excel. I have a data sheet, and a lot of users have to enter their data in the sheet. I have a column with the header - 'linkToData'. Whenever a user clicks on a cell, there has to be a popup, which asks for the 'link text', and 'URL', so the user can enter it easily, than using 'Insert --> Link --> Insert Link'. How do I do this customization? Can you please help?
Thanks.
Solution 1:[1]
If the existing right-click menu item "Link" is not sufficient, then you can try intercepting the SelectionChange() event for the sheet.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim nCol As Integer
nCol = Target.Column
If Target.Row > 1 And Cells(1, nCol) = "linkToData" Then
If Target.Hyperlinks.Count = 0 Then
Application.Dialogs(xlDialogInsertHyperlink).Show
End If
End If
End Sub
Put this code in the VBA module for your sheet (eg "Sheet1(Sheet1)").
If the top cell in the column is "linkToData", and there isn't already a Hyperlink in the cell, then show the Insert Link dialog. You could write you own input form, but this dialog does what you need.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DS_London |
