copy paste deactivated on column A only but includes other columns

LFKim2018

Active Member
Joined
Mar 24, 2018
Messages
267
I made two codes for one sheet to not allow copy paste and right click for column A only.
It work just fine for column A - but when I tried to copy on column B - the marching ants did show up but immediately disappear when I shift cell to copy. and it won't paste..
what is wrong with the codes?
many thanks..

Code:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    Cancel = False
    If Not Intersect(Target, Range("A:A")) Is Nothing Then
        Cancel = True
    End If
End Sub


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("A:A")) Is Nothing Then
        Application.CutCopyMode = False
        Application.OnKey "^c", ""
        Application.CellDragAndDrop = False
    Else
        Application.CellDragAndDrop = True
        Application.OnKey "^c"
        Application.CutCopyMode = True
    End If
End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
It work just fine for column A - means that the copy paste/right click is deactivated and no copy/paste/right click can be done in column A..
 
Upvote 0
the subs are meant to prevent copy paste only to Column A.
it "should" allow copy paste to other columns (which it isn't doing)....
many thanks..
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
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