Editable ranges

hhammash

Board Regular
Joined
Jun 24, 2002
Messages
156
Hi,

How can I lock the whole spreadsheet and keep only the following range active:

C12 to H64

Is is possible to create more than one editable range and lock the rest of the spreadsheet?

Thanks
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Place in the sheet module you want this control in, like: Sheet1.

'Make cell always closed for changes even if protected!
If Target.Address = "$A$2" Then
Target.Offset(1, 0).Select
End If

'Make cell always open for changes even if protected!
If Target.Address = "$B$2" Then
ActiveSheet.Unprotect Password:="admin"
End If

'Keep sheet protected!
If Target.Address <> "$B$2" Then
ActiveSheet.Protect Password:="admin"
End If
End Sub
 
Upvote 0
Before locking the sheet:
Select the cells you wanted to remain editable.
Menu: Format - Cells
Format Cells pane: Click the Protection tab.
Uncheck locked for the selected cells.
 
Upvote 0
Hi,

Thank you
nbrcrunch for the codeless help and Joe Was for the coded one.

It is working.

Thanks a lot
 
Upvote 0
This works for your posted Range, you can add any number of Ranges this way!

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ((Target.Row >= 12 And Target.Row <= 64) And _
(Target.Column >= 3 And Target.Column <= 8)) Then

ActiveSheet.Unprotect Password:="admin"
Else

ActiveSheet.Protect Password:="admin"

MsgBox "You can only edit cells in Range:" & vbLf & vbLf & _
"C12:H64" & vbLf & vbLf & " Your selection: " & Target.Address & _
vbLf & "is not in the Edit Range!"
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top