Write/delete lock in certain cells

rodanny

New Member
Joined
Apr 24, 2024
Messages
7
Office Version
  1. 365
Platform
  1. Windows
I greet you,I have the following problem:A worksheet with two sheetsin sheet 2 I want to block only the first 2 columns so that they cannot be modified/deleted and the rest remain editable.in sheet 1, the row corresponding to sheet 2 can be edited, deleted, but above all, ctr+d should work in both sheets.
I tried the code below in sheet 2 but.....
Ctrl+d doesn't work and in addition it blocks my entire row, not just columns B and C as I wanted.



Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Whoa

Application.EnableEvents = False

If Not Intersect(Range(Target.Address), Range("B24", Range("C24").SpecialCells(xlCellTypeLastCell))) Is Nothing Then
Application.Undo
'End If

LetsContinue:
Application.EnableEvents = True
Exit Sub
Whoa:
MsgBox Err.Description
Resume LetsContinue
End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
i make this solution for the moment....

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Column = 2 Then
MsgBox "Can not EDIT !"
Target.Offset(0, 2).Select
End If
End Sub

but cannot use Ctr+D for multiply cell
 
Upvote 0
i change this....

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Column = 2 And Not IsEmpty(Target.Value2) Then
MsgBox "Can not EDIT !"
Target.Offset(0, 2).Select
End If
End Sub

In this way, if there is nothing in the cell, let me write or more if I put myself under that cell, I can duplicate it (Ctrl+D).
If we find other methods, they are welcome!

For the moment I solved 90% of the problem.
 
Upvote 0
Solution

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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