Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Range won't Unlock

I have code that locks the majority of the cells in my spreadsheet. I then have code that unlocks a group of those cells. The code that unlocks the cells gives me a run-time error 1004: Unable to set the Locked property of the Range class. I don't understand why I'm getting this error. The .Locked = False line is the problem line. The syntax looks right. Any help would be great. Thanks in advance. The code follows

Private Sub optNonUniformed_Click(
Worksheets("TIME AND LEAVE").Protect UserInterfaceOnly:=Tru
Range("A5:P40").Interior.ColorIndex = 2
Range("A5:P40").Locked = Tru
Range("C5:P5,A6:B9,A12:B15,D16,F16,H16,J16,L16,N16 ,P16,N34:N40,D10:D11,F10:F11,H10:H11,J10:J11,L10:L 11,N10:N11,P10:P11,C13:P15,C34:C40").Interior.Colo rIndex = xlNon
Range("D10:D11,F10:F11,H10:H11,J10:J11,L10:L11,N10 :N11,P10:P11,C13:P15,C34:C40").Locked = Fals
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Range won't Unlock

Your code works for me as is in Excel 2K. I just copied, pasted and ran it
with no problems.

--

Vasant


"Matt" wrote in message
...
I have code that locks the majority of the cells in my spreadsheet. I then

have code that unlocks a group of those cells. The code that unlocks the
cells gives me a run-time error 1004: Unable to set the Locked property of
the Range class. I don't understand why I'm getting this error. The .Locked
= False line is the problem line. The syntax looks right. Any help would be
great. Thanks in advance. The code follows.

Private Sub optNonUniformed_Click()
Worksheets("TIME AND LEAVE").Protect UserInterfaceOnly:=True
Range("A5:P40").Interior.ColorIndex = 24
Range("A5:P40").Locked = True

Range("C5:P5,A6:B9,A12:B15,D16,F16,H16,J16,L16,N16 ,P16,N34:N40,D10:D11,F10:F
11,H10:H11,J10:J11,L10:L11,N10:N11,P10:P11,C13:P15 ,C34:C40").Interior.ColorI
ndex = xlNone

Range("D10:D11,F10:F11,H10:H11,J10:J11,L10:L11,N10 :N11,P10:P11,C13:P15,C34:C
40").Locked = False
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to unlock the cell range limitation? manng118 Excel Discussion (Misc queries) 1 October 23rd 09 05:55 AM
Lock or Unlock Range of Cells on Worksheet_Change Event Grahame Coyle Excel Worksheet Functions 3 July 14th 08 12:27 AM
Unlock VBE Brettjg Excel Discussion (Misc queries) 3 October 16th 07 04:45 PM
How to Unlock K New Users to Excel 4 February 2nd 07 09:45 PM
how do i password protect an .xls file? how do i unlock it for automation. e.g. want to unlock and access a .xls from another .xls macro. Daniel Excel Worksheet Functions 1 June 24th 05 02:59 PM


All times are GMT +1. The time now is 09:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"