Do the following:
In the cell where the value is, right-click and select "Hyperlink".
In the hyperlinks window, select the "Put This Document" button and enter the address of the cell itself where the value is. Click OK. This hyperlink will do nothing because it leads to the cell where it was clicked.
- Open the Excel VBA code window (ALT+F11) and add the following code to the spreadsheet:
Private Sub Worksheet_FollowHyperlink(ByVal oTarget As Hyperlink)
Dim sURL As String
sURL = "http://teste/teste/view.php?id=" & ActiveCell.Value
ActiveWorkbook.FollowHyperlink sURL
End Sub
Note that this code captures the event of the specific spreadsheet (to
Worksheet, that is, the tab) and not the whole file. If you have more than one
tab (Plan1, Plan2, Plan3, etc) and want to do the same on it, you need to duplicate
that code.
You will create hyperlinks in cells one by one?
– Luiz Vieira
It can be, as long as I take the value of the cell, in this case I can do it once and drag it down that will apply to all others
– Arthur Moraes
I prepared an answer then. But maybe it is easier for you to create the hyperlinks on your own, using VBA as well. Take a look at
Hyperlinks.Add
.– Luiz Vieira