View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
Sandy Sandy is offline
external usenet poster
 
Posts: 156
Default detect ctrl-c was pressed (in copy mode) from vba?

Try playing around with this:

In your Worksheet_SelectionChange code place this at the beginning:

If Application.CutCopyMode = 1 Or _
Application.CutCopyMode = 2 Then
Call DisableBanding
End If

Then insert a new module and paste this to it:

Sub DisableBanding()
While Application.CutCopyMode = 1 Or _
Application.CutCopyMode = 2
Application.EnableEvents = False
DoEvents
Wend
Application.EnableEvents = True
End Sub


Sandy


Mad Scientist Jr wrote:
I am using color banding to highlight active cells as explained he

Use color banding to locate the active cell
http://office.microsoft.com/en-us/as...366231033.aspx

which I altered to highlight only horizontally, the current row from
cols A to Z

However, this has a side effect where if you press ctrl-c to copy a
cell or range of cells, and then click on a destination cell, ctrl-v no
longer pastes because the color banding code deselects the cells.

Is there a way to detect that ctrl-c has been pressed and excel is in
"copy mode" to disable the color banding, and then re-enable it after
the cells are pasted?