PDA

View Full Version : Allow copy and paste only



Rackon
10-17-2016, 06:23 PM
Hello

I'm using the code below, i just want to know how would I allow copy and paste only without asking password

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim Msg As Variant
Dim pWord As String
pWord = "4224"


If Target.Address = Target.EntireRow.Address Or _
Target.Address = Target.EntireColumn.Address Then
passwrd:
response = InputBox("Enter password")
If response = "" Then

GoTo undochange
ElseIf response <> pWord Then


Msg = MsgBox("Please Enter Correct Password To Continue", 5, "Incorrect Password")
If Msg = 4 Then GoTo passwrd
Msg = "Deleting Rows/Columns Not Permitted"
Msg = MsgBox(Msg, 16, "WARNING")
undochange:
With Application
.EnableEvents = False
.Undo
.EnableEvents = True
End With
Else
Exit Sub
End If
End If
End Sub