PDA

View Full Version : worksheet events issue



ALe
07-13-2006, 01:08 AM
Hi all!

Is there a way to understand which kind of event occured on a worksheet?

I'm trying to trigger an event if the user press "Copy" or tries to copy any cell of the activesheet.

colud it be, associated with selection_change,
if application.cutcopymode=true then
'do it
else
do nothing
end if
?

mdmackillop
07-13-2006, 04:56 AM
Hi Ale,
"True" doen't work for me, so maybe that is your problem too.
try

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.CutCopyMode = 1 Then
MsgBox "Someone is trying to copy this"
Application.CutCopyMode = 0
End If
End Sub

johnske
07-13-2006, 05:11 AM
If you just want to stop them copying...


Option Explicit

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

ALe
07-13-2006, 08:34 AM
they don't work. Both codes are triggered when the change of selection has been made.

To understand what I mean try to select copy then activate another workbook and select paste. The code won't be executed.