View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Miss Kim Miss Kim is offline
external usenet poster
 
Posts: 1
Default Worksheet_Change Event - Macro kills copy and paste

Rob,

Alan said the same code is the Worksheet_SelectionChange
event, so that will still cause the code to exacute once:
after the selection has changed, but before the Copy
command is initiated. I don't think it will be a problem
with Alan's code that only applies formating, but maybe a
better solution is to trap the filter change?

Any thoughts?

-----Original Message-----
Hi Alan,

The value of Application.CutCopyMode will tell you

whether a user has a
cut or copy operation in progress when your event

procedure fires, something
like this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Application.CutCopyMode = 0 Then
''' User hasn't copied anything,
''' run your macro here.
End If
End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Alan" wrote in message
...

Hi All,

I have a macro running upon a Worksheet_Change and

Worksheet_SelectionChange
event from within a worksheet code (not a module).

When a change is made to the worksheet, which is a

filtered list, it calls
a
sub which checks which columns are filtered and

changes the background
colour to make it easier to see, or changes it back to

no fill if the
filter
was removed.

However, if a user tries to copy and paste from one

cell to another, when
they move the cell pointer up a cell (say), one of the

events is triggered
and by the time the macro has run, the contents of the

cell that was
copied
has been lost and paste is ineffective.

I am wondering if there is some way for me to check in

the event procedure
whether the user has tried to copy something, and if

so, then not call the
macro?

Thanks in advance for any help you can render,

Alan.





.