#1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Paste Event

I am trying find out if there is a way to trigger macros
when data is pasted into specific areas of a worksheet (or
just when data is pasted in general). The Change Event
doesn't always recognize changes when data is pasted and I
tried the OnKey Event, which works when you use Ctrl+V to
paste, but I could figure out how to recognize paste when
you do edit-paste or right-click-paste, so right now I am
forced to use the Calculate event. But that triggers the
macro every time a any changes are made to a worksheet. I
just want to monitor a specific area.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Paste Event

There is an event (BeforeDropOrPaste) that you can use, but I've never used
it myself and it looks quite complicated. Search in VBA help for "Paste
Event"

Mike

" wrote:

I am trying find out if there is a way to trigger macros
when data is pasted into specific areas of a worksheet (or
just when data is pasted in general). The Change Event
doesn't always recognize changes when data is pasted and I
tried the OnKey Event, which works when you use Ctrl+V to
paste, but I could figure out how to recognize paste when
you do edit-paste or right-click-paste, so right now I am
forced to use the Calculate event. But that triggers the
macro every time a any changes are made to a worksheet. I
just want to monitor a specific area.

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Paste Event

Is this available in Excel 2000? That is what I have and I
did not see that event.

-----Original Message-----
There is an event (BeforeDropOrPaste) that you can use,

but I've never used
it myself and it looks quite complicated. Search in VBA

help for "Paste
Event"

Mike

" wrote:

I am trying find out if there is a way to trigger

macros
when data is pasted into specific areas of a worksheet

(or
just when data is pasted in general). The Change Event
doesn't always recognize changes when data is pasted

and I
tried the OnKey Event, which works when you use Ctrl+V

to
paste, but I could figure out how to recognize paste

when
you do edit-paste or right-click-paste, so right now I

am
forced to use the Calculate event. But that triggers

the
macro every time a any changes are made to a worksheet.

I
just want to monitor a specific area.

Thanks.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Paste Event

I'm not sure. I using 2003. Sorry I could not be of more help.


" wrote:

Is this available in Excel 2000? That is what I have and I
did not see that event.

-----Original Message-----
There is an event (BeforeDropOrPaste) that you can use,

but I've never used
it myself and it looks quite complicated. Search in VBA

help for "Paste
Event"

Mike

" wrote:

I am trying find out if there is a way to trigger

macros
when data is pasted into specific areas of a worksheet

(or
just when data is pasted in general). The Change Event
doesn't always recognize changes when data is pasted

and I
tried the OnKey Event, which works when you use Ctrl+V

to
paste, but I could figure out how to recognize paste

when
you do edit-paste or right-click-paste, so right now I

am
forced to use the Calculate event. But that triggers

the
macro every time a any changes are made to a worksheet.

I
just want to monitor a specific area.

Thanks.

.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Paste Event

Well, I found a bit of a work around.

Insert the following code into ThisWorksheet.

Private Sub Workbook_Open()
EnableControl 21, True ' cut
EnableControl 19, True ' copy
EnableControl 22, False ' paste
EnableControl 755, False ' pastespecial
End Sub
Sub EnableControl(Id As Integer, Enabled As Boolean)
Dim CB As CommandBar
Dim C As CommandBarControl

On Error Resume Next
For Each CB In Application.CommandBars
Set C = CB.FindControl(Id:=Id, recursive:=True)
If Not C Is Nothing Then C.Enabled = Enabled
Next

End Sub

This will disable the Paste and PasteSpecial functions in both the Edit and
Right click menus. Then the user is forced to use Ctrl-V to paste. You can
then use the OnKey event that you already have.


Mike

" wrote:

I am trying find out if there is a way to trigger macros
when data is pasted into specific areas of a worksheet (or
just when data is pasted in general). The Change Event
doesn't always recognize changes when data is pasted and I
tried the OnKey Event, which works when you use Ctrl+V to
paste, but I could figure out how to recognize paste when
you do edit-paste or right-click-paste, so right now I am
forced to use the Calculate event. But that triggers the
macro every time a any changes are made to a worksheet. I
just want to monitor a specific area.

Thanks.



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
event macros vs copy/paste Dave Excel Worksheet Functions 2 November 17th 08 02:36 AM
user form-on open event? keydown event? FSt1[_3_] Excel Programming 2 August 5th 04 02:26 PM
capture paste event into a cell No Name Excel Programming 3 January 30th 04 07:24 PM
Event Raised by Paste Special + Link cduden Excel Programming 1 January 15th 04 06:50 PM
Worksheet_Change Event - Macro kills copy and paste Alan Excel Programming 5 September 23rd 03 02:58 AM


All times are GMT +1. The time now is 11:03 PM.

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"