Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2007

Tip: Looking for answers? Try searching our database.

cell locking problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
navin - 19 Jan 2007 17:13 GMT
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
Doug Glancy - 19 Jan 2007 19:39 GMT
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

> Hi,
>
[quoted text clipped - 24 lines]
> thanks,
> navin
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.