+ Reply to Thread
Results 1 to 4 of 4

VBA usage & workbook not responding

Hybrid View

Zaeguzah VBA usage & workbook not... 02-01-2010, 05:51 AM
DonkeyOte Re: VBA usage & workbook not... 02-01-2010, 06:21 AM
Zaeguzah Re: VBA usage & workbook not... 02-01-2010, 07:17 AM
DonkeyOte Re: VBA usage & workbook not... 02-01-2010, 07:27 AM
  1. #1
    Forum Contributor
    Join Date
    07-16-2009
    Location
    NA
    MS-Off Ver
    MS Excel 2010
    Posts
    237

    VBA usage & workbook not responding

    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

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: VBA usage & workbook not responding

    A sample file might help yes.

    Questions

    a) how are the hyperlinks created - manual or via functions ?

    b) if created manually - are you using the FollowHyperlink event at all ?


    In essence I can't replicate the perpetual loop you're experiencing irrespective of how the links are created - however - if there were another event taking place somewhere that might help explain things.

  3. #3
    Forum Contributor
    Join Date
    07-16-2009
    Location
    NA
    MS-Off Ver
    MS Excel 2010
    Posts
    237

    Re: VBA usage & workbook not responding

    Hi Donkey,

    I honestly don't know. The sample workbook contain the exact model of hyperlinks that i use in the real book. As for the loop, there is nothing that I can think of. I don't use any kind of events in the workbook only some volatile udf's.

    Thanks for looking into it.
    Attached Files Attached Files

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: VBA usage & workbook not responding

    Are you able to replicate your issue in the sample flie ? I can't (once I add in the code you outlined earlier)

    We need to see the real thing - or at least a version that contains all event based code and the hyperlinks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1