View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
impslayer impslayer is offline
external usenet poster
 
Posts: 22
Default Shouldn't this work?

"Jonathan Cooper" wrote in
message ...
Sub KillIt()
'
' After you have copied a range(i.e., pivot table), this macro
' is used to paste it in inert form, for distribution
' to non-technical users.

If Application.CutCopyMode = True Then
With Selection
.PasteSpecial Paste:=xlPasteValues
.PasteSpecial Paste:=xlPasteFormats
.PasteSpecial Paste:=xlPasteColumnWidths
End With
Else: MsgBox ("You have to copy, before you can paste")
End If
End Sub

When I run this, even after copying a range, it still defaults to the ELSE
section.

The purpose of the macro, is to PASTE, and I want to make sure the user
has
copied something, before they run the macro.


Don't think CutCopyMode really returns True like that, rather xlCopy,
xlCut or False, so your code should be changed to check for False
instead, and moving the paste code to the else branch.

/impslayer, aka Birger Johansson