Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
event macros vs copy/paste | Excel Worksheet Functions | |||
user form-on open event? keydown event? | Excel Programming | |||
capture paste event into a cell | Excel Programming | |||
Event Raised by Paste Special + Link | Excel Programming | |||
Worksheet_Change Event - Macro kills copy and paste | Excel Programming |