karabiner8
Board Regular
- Joined
- Jan 11, 2005
- Messages
- 50
Hi,
I'm developing spreadsheet where the user will enter a path to a network drive in cell B6 of a worksheet named Input. Excel automatically creates a hyperlink after the path is entered. I'd like to use a Worksheet Change event to remove the hyperlink as soon as it's created but instead of entering "$B$6" as the target address I'd like to use the Name I've assigned to the range ("ScrdPath"). This way I don't have to worry about the target cell moving while I'm changing the layout of the worksheet.
This code works:
This code does nothing (no errors reported):
I've checked to make sure that I named cell B6 ScrdPath. Can anyone tell me what I'm doing wrong?
Thanks
I'm developing spreadsheet where the user will enter a path to a network drive in cell B6 of a worksheet named Input. Excel automatically creates a hyperlink after the path is entered. I'd like to use a Worksheet Change event to remove the hyperlink as soon as it's created but instead of entering "$B$6" as the target address I'd like to use the Name I've assigned to the range ("ScrdPath"). This way I don't have to worry about the target cell moving while I'm changing the layout of the worksheet.
This code works:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$6" Then
Range("$B$6").Hyperlinks.Delete
End If
End Sub
This code does nothing (no errors reported):
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("ScrdPath") Then
Range("ScrdPath").Hyperlinks.Delete
End If
End Sub
I've checked to make sure that I named cell B6 ScrdPath. Can anyone tell me what I'm doing wrong?
Thanks