VBA Detect Paste

crspycrtr

New Member
Joined
Mar 23, 2011
Messages
7
I have a worksheet that automatically clears the cells in the columns to the right of the changed cell. The problem is that if I copy and paste the row above and paste it to several rows below, the first pasted row has the data to the right cleared all of the other rows are fine. I need to be able to recognize when someone is pasting so I can exit the macro.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Post your code so a better understanding can be had about what you are doing programmatically, and how the action can be bypassed for paste based on the logic you are using to trigger the (presumably) Change event.
 
Upvote 0
I think I understand his question because it sounds similar to the issue for which I was searching for a solution. My solution was to place a sub in the ThisWorkbook module:

Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
   If Target.Count > 1 Then
      MsgBox("You just pasted " & Target.Count & " cells of data into sheet " & Sh.Name & "!")
   End If
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,254
Members
452,900
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top