I'm trying to make hyperlinks in the first column on the condition that value in the cell begins with 'W'.
It seemed to work until I moved the script from Sheet object to ThisWorkbook.
Since then when I try to copy some cells from another worksheet and paste them to active worksheet, everything what I copied is pasted as hyperlink, no matter what column or value it is. What's more, if I try to type anything in the row where the first cell is linked, the default typing mode is in the hyperlink style.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim KeyCells2 As Range
Set KeyCells2 = Range("A:A")
If Not Application.Intersect(KeyCells2, Range(Target.Address)) _
Is Nothing Then
On Error Resume Next
If Target.Count = 1 Then 'this one was meant to be a fix but it didn't change a thing
If Left(Target.Value, 1) = "W" Then
link = "http://<mylink>" & Target.Value
ActiveSheet.Hyperlinks.Add Target, link
End If
End If
End If
End Sub
Range(Target.Address)? It's not qualified. WouldTarget(which is) not do?KeyCells2 = Range("A:A")isn't qualified.