disallowing copying of rows

  • Thread starter Thread starter Nasir.Munir
  • Start date Start date
N

Nasir.Munir

Is it possible to disallow copying of rows.
I just dont want a row to be copied and pasted, can anyone tell me how
to do that.
I am just trying to avoid the duplicate entries associated with a row.
For example, if rows are assigned a unique value(i have used validation
option), and then if someone copy and paste the value it allows it to
do so. In order to avoid that, I want to restrict a user to go for
copying a row and pasting it elsewhere.
Someone please help,
Regards,
Nasir.
 
Try this. You can't stop the Copy, but you can stop the Paste.
Depending on your needs, you can a check of the Target invloved, to see if
it is allowed or not.

Dim Cutting As Boolean

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Msg As String

With Application
Select Case .CutCopyMode
Case False
If Cutting Then
Msg = "Was Cut"
Else
Msg = "Normal Entry"
End If
Case xlCopy
Msg = "Pasted Copy"
.EnableEvents = False
.Undo
.EnableEvents = True
End Select
End With
MsgBox Msg

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cutting = (Application.CutCopyMode = xlCut)
End Sub

NickHK
 
Nick, I understand what u mean. Thanks for the help, however, the code
is not working. Any suggestion?
 
I suggest you provide a bit more explanation to "the code is not working" .

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top