hi, i am trying to find a test for if excel currently has itself in a cut or copy state. i don't know if the following is related, but is all can find.
it will basically be for another "PASTE" macro, so it will not insert a bogus line if there is no currently cut/ copy "LINE" currently active, same as for accidently start of the Paste macro.. thanks.
i hit copy on a line, then tried to run the following, nothing happened.
If Application.CutCopyMode = True Then
MsgBox ("Macro Works")
End If
========== ANSWERS (variations that work as listed below)
UPDATE: have been working on this some. will have to get back with mixing all previous eg's found on this top post, but i have some other answers that seem interesting. these new items seem to show a NON STANDARD approach for what was made for the vb.
maybe something ms can fix:
(you can test any of these lines with the YES NO msgbox item below it.
'HHHMODE HHHCUTCOPY
'If Application.CutCopyMode <> xlCut And Application.CutCopyMode <> xlCopy Then 'yes
'If application.CutCopyMode Then 'yes test for either cutcopy mode to be true
'If application.CutCopyMode = False Then 'yes
'If Not application.CutCopyMode Then 'no test for NOT either cutcopy mode
'If application.CutCopyMode = True Then 'big friggin no, why
MsgBox "YES" & Space(15), vbQuestion
Else
MsgBox "NO" & Space(15), vbQuestion
End If
==========
The items below might work in simple message box, but the example that got to work with other VB:
'If Application.CutCopyMode = xlCut Or Application.CutCopyMode = xlCopy Then 'both yes
----------
If Application.CutCopyMode = xlCut Or Application.CutCopyMode = xlCopy Then 'both yes
'If Application.CutCopyMode = 0 Then 'yes: 0 off, 1 copy, 2 cut
'If Application.CutCopyMode Then 'both yes cut-copy work / for all 3 states
'If Not Application.CutCopyMode Then 'both yes
'If Application.CutCopyMode = xlCut Then 'cut yes
'If Application.CutCopyMode = xlCopy Then 'copy yes
'If Not Application.CutCopyMode = False Then 'yes for both on, double neg skip
'If Application.CutCopyMode = False Then 'yes for both off
'If Application.CutCopyMode = True Then 'no for either on, does not work..
MsgBox ("Macro Works")
End If
If Application.CutCopyMode = xlCopy Then
MsgBox ("Excel is Copying cells")
ElseIf Application.CutCopyMode = xlCut Then
MsgBox ("Excel is Cutting cells")
End If