Experts Exchange connects you with the people and services you need so you can get back to work.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.CutCopyMode = 1 Or _
Application.CutCopyMode = 2 Then
MsgBox "you hit control c before that selection change!"
Open in new window
Private Sub AssignMacro(ByVal strProc As String)
Dim lngId As Long
Dim CtrlCbc As CommandBarControl
Dim CtrlCbcRet As CommandBarControls
Dim arrIdNum As Variant
' 295 Insert Cells from worksheet menu
' 296 Insert rows from worksheet menu
' 945 Insert from right click menu
arrIdNum = Array(19)
For lngId = LBound(arrIdNum) To UBound(arrIdNum)
Set CtrlCbcRet = CommandBars.FindControls(ID:=arrIdNum(lngId))
If Not CtrlCbcRet Is Nothing Then
For Each CtrlCbc In CtrlCbcRet
CtrlCbc.OnAction = strProc
Set CtrlCbcRet = Nothing
Application.OnKey "^c", "RunHello"
Application.OnKey "^c", vbNullString
MsgBox "You Pressed the CTRL+c Key combo"
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Premium members get this course for $99.99.
Premium members get this course for $62.50.
Premium members get this course for $389.00.
Premium members get this course for $79.20.
Premium members get this course for $12.50.
Premium members get this course for $159.20.