Tuesday, February 17, 2009

Excel VBA: Cut and paste using macro

In this Excel VBA Macro Examples section, I will show you how to move a range. This following example will move a range A4:E4 to I15:M15 in active sheet.

Sub MoveRange()
  ActiveSheet.Range("A4:E4").Cut _
    Destination:=ActiveSheet.Range("I15")
End Sub

If Destination argument is omitted, Microsoft Excel cuts the range to the Clipboard.

Related posts:

No comments:

Post a Comment