MS Excel 2000 Select hyperlink on a macro enabled protected sheet

Excel Discussion in 'Microsoft Office' started by wheelert6, Jun 26, 2012.

  1. wheelert6

    wheelert6

    Joined:
    Jun 4, 2012
    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
    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. ChaozFear

    Excel MS WORD 2000 - Macro to copy spesific lines into excel/word

    ChaozFear, Sep 20, 2005, in forum: Microsoft Office
    Replies:
    0
    Views:
    419
    ChaozFear
    Sep 20, 2005
  2. berny

    Excel MS Excel calculation HELP!

    berny, Jun 6, 2006, in forum: Microsoft Office
    Replies:
    0
    Views:
    359
    berny
    Jun 6, 2006
  3. Alex Wilson

    Excel MS Excel formula query.

    Alex Wilson, Apr 25, 2007, in forum: Microsoft Office
    Replies:
    1
    Views:
    1,205
    muckshifter
    Apr 25, 2007
  4. ccvalentine

    Excel MS Excel Data Label Problem

    ccvalentine, Dec 18, 2007, in forum: Microsoft Office
    Replies:
    0
    Views:
    437
    ccvalentine
    Dec 18, 2007
  5. tom montgomery

    Excel MS Excel worksheet text converter problem

    tom montgomery, May 9, 2008, in forum: Microsoft Office
    Replies:
    0
    Views:
    442
    tom montgomery
    May 9, 2008
  6. jollysalman

    Excel Ms Excel 2003 help

    jollysalman, May 18, 2008, in forum: Microsoft Office
    Replies:
    2
    Views:
    945
    davesexcel
    Mar 7, 2015
  7. shailesh_bali

    Excel MS excell File Error, MS Win XP Professional Version 2002

    shailesh_bali, Nov 17, 2009, in forum: Microsoft Office
    Replies:
    1
    Views:
    571
    Chuck D
    Jan 3, 2010
  8. kargus

    Excel MS Queries in Excel 2000 now on 2007

    kargus, Sep 20, 2010, in forum: Microsoft Office
    Replies:
    0
    Views:
    587
    kargus
    Sep 20, 2010
Loading...