excelvba

Copy range to clipboard


I would like to copy a range (specified in the VBA code: A1:I1) into the clipboard, so that the user can paste it whereever he like. How could I do this?


Solution

  • Range has a Copy method on it, so to copy a range you can just do:

    Sub Macro1()
        Range("A1:I1").Copy
    End Sub