PDA

View Full Version : How to prevent copying of cell data



trakindo
08-23-2007, 12:32 AM
I would like requesting helps. Please tell me how to prevent copying cell data on excel using VBA code Thanks

anandbohra
08-23-2007, 12:39 AM
do this
& note before running this macro click on blank cell first

Sub prevent_copy()
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlNoSelection
End Sub

trakindo
08-23-2007, 12:48 AM
I have tried that script, yes we can't select the cell but if I right click the cell then select copy and paste on another excel sheet, the content of the cell was pasted

I'm trying to use this script
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Rows.Count > 1 or Target.Columns.Count>1 Then _
Cells(Target.Row, Target.Column).Select Application.CutCopyMode_
= False
End Sub



But Not work, Please your suggestion. Thanks

Bob Phillips
08-23-2007, 01:12 AM
You could remap the Copy buttons on File and right-click and re-assign Ctrl-C.

anandbohra
08-23-2007, 01:13 AM
for that only i told u to select blank cell before executing this macro then it will copy the data but there will be no records to paste & because of protection he can not further select the data in protect sheet

his selection will be limited to first selected cell only before executing the macro