read / write clipboard VBA

  • Thread starter Thread starter ThomasX
  • Start date Start date
T

ThomasX

I am writing a macro in which I refer to the clipboard. So I asked:
how to save a range of cells to the clipboard to later in the loop
repeatedly retrieve the data from the clipboard.
 
This is one technique that may help:

Option Explicit
Sub testme()

Dim FromCell As Range
Dim DestCell As Range
Dim iCtr As Long

With ActiveSheet
Set FromCell = .Range("A1")
Set DestCell = .Range("B1")
End With

For iCtr = 1 To 10
FromCell.Copy _
Destination:=DestCell
Set DestCell = DestCell.Offset(1, 0)
Next iCtr

End Sub
 
Back
Top