Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi there,
I need to write code allow the user to enter dato only on cells that are unprotected. What I need is to protect cells outside a given range. On a 6 x 6 matrix, where N=3, protect all cells on rows and columns 4,5,6 4,5. If N=2, protect all cells in rows and columns 3,4,5,6. thank you in advance. NeedHelp |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have assumed that your 6x6 range is named Matrix.....
Sub UnprotectMatrix() Dim N As Integer N = 3 With Range("Matrix") .Parent.Unprotect .Cells.Locked = True .Columns(1).Resize(, N).Locked = False .Parent.Protect End With End Sub HTH, Bernie MS Excel MVP "OMER" wrote in message ... hi there, I need to write code allow the user to enter dato only on cells that are unprotected. What I need is to protect cells outside a given range. On a 6 x 6 matrix, where N=3, protect all cells on rows and columns 4,5,6 4,5. If N=2, protect all cells in rows and columns 3,4,5,6. thank you in advance. NeedHelp |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank You very much Bernie.
I made a slight change to it, since I needed to also protect rows 4,5,6. This is how it ended up. Sub UnprotectMatrix() Dim N As Integer N = 3 With Range("Matrix") .Parent.Unprotect .Cells.Locked = True .Resize(N, N).Locked = False .Parent.Protect End With End Sub Again, thanks "Bernie Deitrick" wrote: I have assumed that your 6x6 range is named Matrix..... Sub UnprotectMatrix() Dim N As Integer N = 3 With Range("Matrix") .Parent.Unprotect .Cells.Locked = True .Columns(1).Resize(, N).Locked = False .Parent.Protect End With End Sub HTH, Bernie MS Excel MVP "OMER" wrote in message ... hi there, I need to write code allow the user to enter dato only on cells that are unprotected. What I need is to protect cells outside a given range. On a 6 x 6 matrix, where N=3, protect all cells on rows and columns 4,5,6 4,5. If N=2, protect all cells in rows and columns 3,4,5,6. thank you in advance. NeedHelp . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Password Protect Specific Range Of Cells | Excel Discussion (Misc queries) | |||
How do I protect cells or a range of cells in excel spreadsheet? | Excel Worksheet Functions | |||
Protect/Restrict usage of a range of cells. | Excel Discussion (Misc queries) | |||
Hlp! Protect Cells in Dynamic Range | Excel Discussion (Misc queries) | |||
is there a way to protect a range of cells on a worksheet? | Excel Discussion (Misc queries) |