ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   catch event (https://www.excelbanter.com/excel-programming/391820-catch-event.html)

Nader Tewelde

catch event
 
Hello,

Is it possible to catch the event paste ?

I'd like to inform the user when is doing a copy & paste that some data
needs to be changed once the paste is done.

Thanks in advance.

Nader



Héctor Miguel

catch event
 
hi, Nader !

Is it possible to catch the event paste ?
I'd like to inform the user when is doing a copy & paste
that some data needs to be changed once the paste is done.


i think you could start with the following workaround and adapt to meet your conditions:

[ThisWorkbook code module]

Dim Possible_Paste As Boolean
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Possible_Paste = Application.CutCopyMode = xlCopy
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Possible_Paste = Application.CutCopyMode = xlCopy
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Possible_Paste Then
MsgBox "You have modified cell(s) that seems to come from a Paste-operation ..."
End If
End Sub

hth,
hector.



Nader Tewelde

catch event
 
Thanks Hector.

"Héctor Miguel" a écrit dans le message de
news: ...
hi, Nader !

Is it possible to catch the event paste ?
I'd like to inform the user when is doing a copy & paste
that some data needs to be changed once the paste is done.


i think you could start with the following workaround and adapt to meet
your conditions:

[ThisWorkbook code module]

Dim Possible_Paste As Boolean
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Possible_Paste = Application.CutCopyMode = xlCopy
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
Possible_Paste = Application.CutCopyMode = xlCopy
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If Possible_Paste Then
MsgBox "You have modified cell(s) that seems to come from a
Paste-operation ..."
End If
End Sub

hth,
hector.





All times are GMT +1. The time now is 04:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com