Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default disallowing copying of rows

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default disallowing copying of rows

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

wrote in message
oups.com...
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default disallowing copying of rows

Nick, I understand what u mean. Thanks for the help, however, the code
is not working. Any suggestion?


NickHK wrote:
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

wrote in message
oups.com...
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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default disallowing copying of rows

I suggest you provide a bit more explanation to "the code is not working" .

NickHK

wrote in message
ups.com...
Nick, I understand what u mean. Thanks for the help, however, the code
is not working. Any suggestion?


NickHK wrote:
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

wrote in message
oups.com...
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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying multiple rows to other worksheets (but amount of rows varies) - How? David Smithz Excel Discussion (Misc queries) 1 June 18th 06 04:31 PM
Disallowing a blank text box Kristen[_2_] Excel Programming 1 April 5th 06 08:23 PM
Disallowing duplication of nmbers in a column Barb1 Excel Discussion (Misc queries) 1 April 28th 05 03:44 PM
disallowing blank cells ΊΌΦέΘΛ Excel Programming 0 April 13th 05 12:14 PM
Disallowing Update briank Excel Programming 2 February 18th 05 10:49 PM


All times are GMT +1. The time now is 03:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"