Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88111

How to hyperlink correctly

$
0
0

Hyperlink Issue

Sub GoToPCell()

Dim i As Long, j As Integer
Dim PCell As String
Dim lastrow As Long
Dim rng As Range

With Sheet1.Range("A:A")
If Application.WorksheetFunction.CountA(.Cells) <> 0 Then
Set rng = .SpecialCells(xlCellTypeConstants, 1)
Set rng = rng.Areas(rng.Areas.Count)
lastrow = rng.Cells(rng.Cells.Count).Row
End If
End With

For i = 2 To lastrow

If Not IsEmpty(Cells(i, "CT").End(xlToRight)) Then
PCell = Cells(i, "CT").End(xlToRight).Address
ActiveSheet.Hyperlinks.Add Cells(i, 2), Address:="", SubAddress:="'"& Sheet1.Name & "'!"& PCell
End If

Next i

End Sub

Would like to leave the blank cell on the left without creating a blue hyperlink named the current worksheet.


Viewing all articles
Browse latest Browse all 88111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>