title: is it possible to recover the parameters of the PasteSpecial action in excel through vba?
body: <p>is there a way to &quot;listen' to the PasteSpecial command and its parameters in excel?
  I'm writing a vba code to manage the Range.PasteSpecial method and realized I need a way to know if the Transpose parameter of the action defined by the user is true or false, so I can treat the source data accordingly.
  Offcourse, since I don't know when Transpose is TRUE, this piece of code below does not really work.</p>
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
  Dim UndoList As String
  
  Application.ScreenUpdating = False
  Application.EnableEvents = False
  
  If Application.CommandBars(&quot;Standard&quot;).Controls(&quot;&amp;Undo&quot;).Enabled = True Then
  
     UndoList = Application.CommandBars(&quot;Standard&quot;).Controls(&quot;&amp;Undo&quot;).List(1)
     MsgBox (UndoList &amp; &quot;!&quot;)
       If Left(UndoList, 5) = &quot;Paste &quot; Or UndoList = &quot;Paste special&quot; Then
          
          If UndoList = &quot;Paste special&quot; Then
              If Transpose Then
              MsgBox (&quot;Paste Transposed Values&quot;)
               Application.EnableEvents = False
               Application.Undo
               Application.EnableEvents = True
               Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
               'and other stuff
              Exit Sub
              Else
              MsgBox (&quot;Paste Values&quot;)
               Application.EnableEvents = False
               Application.Undo
               Application.EnableEvents = True
               Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
               'and other stuff
              Exit Sub
           End If
           ElseIf Left(UndoList, 5) = &quot;Paste&quot; Then
          MsgBox (&quot;Just Paste formats&quot;)
          Application.EnableEvents = False
              Application.Undo
              Application.EnableEvents = True
              Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False
  
          Exit Sub
  
       Else
          MsgBox (&quot;choose another method&quot;)
           'Application.Undo
       Exit Sub
       End If
  Else
  Exit Sub
  End If
  UndoList = &quot;&quot;
  End If
  End Sub
  
  
  
  
  </code></pre>