Filehost.ro - gazduire fisiere
Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Nou pe simpatie:
Diana2019
Femeie
25 ani
Vaslui
cauta Barbat
25 - 80 ani
Mrrrr's Forum (VIEW ONLY)ReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides /

[EXCEL] Hyperlink a Cell to Itself (VBA)

Pagini: 1 Moderat de TRaP, TonyTzu
#1
TRaP
Moderator
Postari: 960
The code below adds hyperlink to cells in selection to themselves.

I use this for using hyperlinks to external PDF files for going to a specific page in that PDF file.
See an example of what I mean here: http://mrrrr.3xforum.ro/post/2414/EXCEL ... -XChange_/


Sub HyLnk_cell_to_oneself()

For Each cell In Selection
    i = cell.Address
   
    If cell.Value <> "" Then
        ActiveSheet.Hyperlinks.Add Anchor:=cell, Address:="", SubAddress:=Chr(39) & ActiveSheet.Name & Chr(39) & "!" & i, TextToDisplay:=cell.Value
    End If
Next cell

End Sub


updated


 
   
#2
TRaP
Moderator
Postari: 960
Added an IF clause since the original code errors if any cell in range is empty.

 
   
Pagini: 1  
Mergi la