Hi everyone,
I found this script on ozgrid and it works well except when I use hyperlinks to other sheets. The hyperlinks have custom names and the cell where the hyperlinks leads, contains another hyperlink back to the first hyperlink. (if needed i'll supply an example book).
The problem is that when i click on such a hyperlink, the workbook goes crazy, doesn't respond to any command and uses the cpu up to a maximum.
Any ideas why it's acting this way?
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Dim rFormulaCheck As Range
On Error Resume Next
ActiveSheet.Unprotect Password:="0"
With Selection
.Locked = False
.FormulaHidden = False
End With
If Target.Cells.Count = 1 Then
If Target.HasFormula Then
With Target
.Locked = True
.FormulaHidden = True
End With
ActiveSheet.Protect Password:="0", UserInterFaceOnly:=True
End If
ElseIf Target.Cells.Count > 1 Then
Set rFormulaCheck = Selection.SpecialCells(xlCellTypeFormulas)
If Not rFormulaCheck Is Nothing Then
With Selection.SpecialCells(xlCellTypeFormulas)
.Locked = True
.FormulaHidden = True
End With
ActiveSheet.Protect Password:="0", UserInterFaceOnly:=True
End If
End If
On Error GoTo 0
End Sub
Thanks for all the help so far,
Alex
Bookmarks