Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Locked cells

How do I lock/unlock cells in code?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Locked cells

Hi Amy

Selection.Locked = True

Selection.Locked = False

Or

Range("A1:c10").Locked = True


Or all cells on the worksheet

Cells.Locked = True


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Amy" wrote in message ...
How do I lock/unlock cells in code?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Locked cells

okay this is what I have:
Private Sub Workbook_Open()
'check for filter, turn on if none exists
With Worksheets("worksheet")
If Not .AutoFilterMode Then
.Range("A2").AutoFilter
End If
.EnableAutoFilter = True
.Protect Password:="password", _
Contents:=True, UserInterfaceOnly:=True
Range("C:C,D:D,L:L").Selec
Selection.Locked = True
End With
End Sub

it doesn't lock the cells.... any ideas?
-----Original Message-----
Hi Amy

Selection.Locked = True

Selection.Locked = False

Or

Range("A1:c10").Locked = True


Or all cells on the worksheet

Cells.Locked = True


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Amy" wrote in message

...
How do I lock/unlock cells in code?



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Locked cells

Change the locked before you protect the sheet

Try this

Private Sub Workbook_Open()
'check for filter, turn on if none exists
With Worksheets("worksheet")
If Not .AutoFilterMode Then
.Range("A2").AutoFilter
End If
.Range("C:C,D:D,L:L").Locked = True
.EnableAutoFilter = True
.Protect Password:="password", _
Contents:=True, UserInterfaceOnly:=True
End With
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Amy" wrote in message ...
okay this is what I have:
Private Sub Workbook_Open()
'check for filter, turn on if none exists
With Worksheets("worksheet")
If Not .AutoFilterMode Then
.Range("A2").AutoFilter
End If
.EnableAutoFilter = True
.Protect Password:="password", _
Contents:=True, UserInterfaceOnly:=True
Range("C:C,D:D,L:L").Selec
Selection.Locked = True
End With
End Sub

it doesn't lock the cells.... any ideas?
-----Original Message-----
Hi Amy

Selection.Locked = True

Selection.Locked = False

Or

Range("A1:c10").Locked = True


Or all cells on the worksheet

Cells.Locked = True


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Amy" wrote in message

...
How do I lock/unlock cells in code?



.



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
Locked Cells JOSEPH WEBER Excel Discussion (Misc queries) 0 April 26th 10 09:37 PM
Locked worksheet & hyperlinks (w/ select locked cells unchecked) dgold82 Excel Discussion (Misc queries) 1 July 10th 09 09:42 PM
Locked Cells PAL Excel Worksheet Functions 1 October 7th 08 08:35 PM
paste locked cells and unlocked cells in protected sheet Angeline Excel Worksheet Functions 15 November 1st 06 11:51 PM
Put comments on a locked spreadsheet even though cells not locked RDP Excel Worksheet Functions 1 September 11th 05 11:59 PM


All times are GMT +1. The time now is 09:42 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"