PC Review


Reply
Thread Tools Rate Thread

cell locking problem

 
 
navin
Guest
Posts: n/a
 
      19th Jan 2007
Hi,

I have a sheet, in which i have to lock a single cell. i used the
following code:

ActiveSheet.Range("$J$29:$K$29").Select
Range("$J$29:$K$29").Select
ActiveSheet.Unprotect
Selection.Locked = True
Range("$J$29:$K$29").Select
ActiveSheet.Protect DrawingObjects:=False, Contents:=True,
Scenarios:= _
False, AllowFormattingCells:=True,
AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True,
AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True,
AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True,
AllowFiltering:=True, _
AllowUsingPivotTables:=True
ActiveSheet.EnableSelection = xlUnlockedCells

above code locks the cell perfectly, but it also locks some of the cell
below the locked cell ($J$29). Please help.

thanks,
navin

 
Reply With Quote
 
 
 
 
Doug Glancy
Guest
Posts: n/a
 
      19th Jan 2007
navin,

With Activesheet
.Unprotect
.Range("J29").Locked = True
.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True,
AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
End With

hth,

Doug

"navin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I have a sheet, in which i have to lock a single cell. i used the
> following code:
>
> ActiveSheet.Range("$J$29:$K$29").Select
> Range("$J$29:$K$29").Select
> ActiveSheet.Unprotect
> Selection.Locked = True
> Range("$J$29:$K$29").Select
> ActiveSheet.Protect DrawingObjects:=False, Contents:=True,
> Scenarios:= _
> False, AllowFormattingCells:=True,
> AllowFormattingColumns:=True, _
> AllowFormattingRows:=True, AllowInsertingColumns:=True,
> AllowInsertingRows _
> :=True, AllowInsertingHyperlinks:=True,
> AllowDeletingColumns:=True, _
> AllowDeletingRows:=True, AllowSorting:=True,
> AllowFiltering:=True, _
> AllowUsingPivotTables:=True
> ActiveSheet.EnableSelection = xlUnlockedCells
>
> above code locks the cell perfectly, but it also locks some of the cell
> below the locked cell ($J$29). Please help.
>
> thanks,
> navin
>



 
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 locking cell based on value in another cell =?Utf-8?B?S2Vsc29u?= Microsoft Excel Programming 1 10th Oct 2007 11:10 PM
Locking Cell dependent on Another Cell Value =?Utf-8?B?ZWwgem9ycm8=?= Microsoft Excel Misc 7 13th Aug 2007 09:54 PM
Dynamically locking a cell depending upon value of another cell. =?Utf-8?B?UGFuaw==?= Microsoft Excel Misc 0 12th May 2006 11:48 AM
Excel Cell Protection / Locking Problem HalfGreyhound Microsoft Excel Misc 1 5th May 2004 05:25 PM
Locking cell color while allowing data changes in cell Barb Microsoft Excel Misc 2 5th Sep 2003 01:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:15 PM.