PC Review


Reply
Thread Tools Rate Thread

MS Excel 2000 Select hyperlink on a macro enabled protected sheet

 
 
New Member
Join Date: Jun 2012
Posts: 9
 
      26th Jun 2012
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
 
Reply With Quote
 
 
 
 
New Member
Join Date: Aug 2012
Posts: 16
 
      2nd Aug 2012
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007-macro enabled, multi-sheet opening in minimized mode LT Microsoft Excel Misc 0 11th Mar 2010 06:36 PM
How do I select price from sheet.b where sheet.a part no = sheet.b =?Utf-8?B?U29ubnk=?= Microsoft Excel Worksheet Functions 4 4th Apr 2006 05:08 PM
excel - macro code to open a protected sheet, enter passowrd, and then protect sheet arunjoshi Microsoft Excel Programming 1 2nd May 2004 03:50 PM
Macro enabled Hyperlinks in a protected document =?Utf-8?B?bWljayBoaWx0b24=?= Microsoft Word Document Management 0 12th Nov 2003 04:01 PM
cookies enabled but hotmail won't open stating cookies are not enabled dorr tippens Windows XP Internet Explorer 1 26th Jul 2003 01:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:26 PM.