MS Excel 2000 Select hyperlink on a macro enabled protected sheet

Discussion in 'General Software' started by wheelert6, Jun 26, 2012.

  1. wheelert6

    wheelert6

    Joined:
    Jun 4, 2012
    Messages:
    9
    Likes Received:
    0
    Hi. I have a select range of cells with a set of code that unprotects the sheet when selected in order to allow hyperlinks to be created.

    However when I select an active hyperlink in one of those cells it gives me the following error even though it works correctly:

    Run-time error '9':

    Subscript out of range

    The code is as follows:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Column = 13 Then
    Sheets("Summary of Contracts").Unprotect Password:=""
    Else
    Sheets("Summary of Contracts").Protect Password:=""
    End If
    End Sub

    I would like to ask whether this error can be avoided or whether some coding can be added to hide/remove the error message itself.

    Thanks
     
    wheelert6, Jun 26, 2012
    #1
    1. Advertisements

  2. wheelert6

    pjmorris

    Joined:
    Aug 1, 2012
    Messages:
    16
    Likes Received:
    0
    I tried this on my machine and it was caused when the sheet name wasn't 'Summary of Contracts'. Suggest you need to check the sheet name, if you don't use the sheet names then you could use sheets(1).unprotect etc. But thats not a great idea either!
     
    pjmorris, Aug 2, 2012
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. cystia

    Excel (2000) Macro recorder is missing!

    cystia, Feb 23, 2009, in forum: General Software
    Replies:
    2
    Views:
    492
    Madxgraphics
    Feb 23, 2009
  2. Patricia Ziegler

    Excel 2007 Macro Hyperlink

    Patricia Ziegler, Jul 4, 2010, in forum: General Software
    Replies:
    0
    Views:
    671
    Patricia Ziegler
    Jul 4, 2010
  3. rachelsmith
    Replies:
    1
    Views:
    387
    Flona2012
    Nov 7, 2012
  4. ismaili
    Replies:
    2
    Views:
    2,088
    ismaili
    Mar 8, 2013
  5. dadams
    Replies:
    0
    Views:
    495
    dadams
    Jun 16, 2014
Loading...

Share This Page