Paste Only Values Locked Cells

SensualCarrots

New Member
Joined
Mar 21, 2015
Messages
46
I am using the following code I found somewhere in a workbook to prevent traditional pasting to avoid wiping out cell formatting. I only want to allow paste values.

Code:
Private Sub Workbook_SheetSelectionChange(ByVal sh As Object, ByVal Target As Range)

    If Sheet3.UnlockWorkbookCheckbox = False Then
        On Error Resume Next
        Target.PasteSpecial xlPasteValues
        Application.CutCopyMode = True
    End If


End Sub

The problem is that for some reason, once copied, values will be pasted into any cell on the worksheet, regardless if they are locked or not. And yes, the worksheet is protected, but it's protected via the below code which I suspect may be the problem... I commented the entire code block, and it prevents all pasting, including values. Any ideas?

Code:
Sheet3.Protect Password:="password", UserInterfaceOnly:=True
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,223,974
Messages
6,175,739
Members
452,667
Latest member
vanessavalentino83

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