Kanita
New member
- Joined
- Sep 30, 2020
- Messages
- 7
- Reaction score
- 0
- Points
- 0
- Excel Version(s)
- Excel for Mac
Hi there,
I have a file with protected worksheets. Some cells (with formulas) are protected, some are not. Because of protection of some cells my colleagues can not insert a row and copy the one above. That's why I want to use a macro. My solution was the following:
It works, but double click is something, my colleagues want to have for other reasons. I wanted to change it for a shortcut, like Ctrl+D. But because I am not a professional I can not do it myself. Could someone help me to fix the problem?
Thanks a lot!!!
I have a file with protected worksheets. Some cells (with formulas) are protected, some are not. Because of protection of some cells my colleagues can not insert a row and copy the one above. That's why I want to use a macro. My solution was the following:
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Updateby Extendoffice 20160725
Cancel = True
ActiveSheet.Protect Password:="XXXX", UserInterfaceOnly:=True
Target.Offset(1).EntireRow.Insert
Target.EntireRow.Copy Target.Offset(1).EntireRow
On Error Resume Next
Target.Offset(1).EntireRow.SpecialCells(xlConstants).ClearContents
End Sub
It works, but double click is something, my colleagues want to have for other reasons. I wanted to change it for a shortcut, like Ctrl+D. But because I am not a professional I can not do it myself. Could someone help me to fix the problem?
Thanks a lot!!!
Last edited by a moderator: