Copy Range with VBA to clipboard
<p>So here is what I'm trying to do. I have a sheet to parse Cisco router interface errors between snapshots to create a summary of how many packets and errors were on each interface. I have a button tied to a macro that executes this to copy just the summary itself.</p>

<pre><code>x1 = Cells(2, 6).Value
y1 = Cells(3, 6).Value
x2 = Cells(4, 6).Value
y2 = Cells(5, 6).Value

ActiveSheet.Range(Cells(y1, x1), Cells(y2, x2)).Copy
</code></pre>

<p>Each of the cells listed have the value of row or column for the sections to be copied correctly. x2's cell is set based on how many interfaces so it can change the selected range. </p>

<p>My problem lies with wanting to copy this and the latest snapshot (which is in the cell directly above the summary section) together. I want to place the snapshot under the summary ideally when copied to the clipboard. To do this I've imagine I'll need to convert the range to a string then add both strings together and put it in the clipboard. However I can't even get the range to convert to something I can put in the clipboard. This is the code I'm using below which was found on here for converting a range to a string array and another for putting strings into the clipboard. However I can't figure out how to get the string array into the clipboard as it always errors out as 'Object required'. Any help would be appreciated.</p>

<pre><code>x1 = Cells(2, 6).Value
y1 = Cells(3, 6).Value
x2 = Cells(4, 6).Value
y2 = Cells(5, 6).Value
    ' Get values into a variant array
Dim variantValues As Variant
variantValues = ActiveSheet.Range(Cells(y1, x1), Cells(y2, x2)).Value

' Set up a string array for them
Dim stringValues() As String
ReDim stringValues(1 To UBound(variantValues, 1), 1 To UBound(variantValues, 2))

' Put them in there!
Dim columnCounter As Long, rowCounter As Long
For rowCounter = UBound(variantValues, 1) To 1 Step -1
   For columnCounter = UBound(variantValues, 2) To 1 Step -1
       stringValues(rowCounter, columnCounter) = CStr(variantValues(rowCounter, columnCounter))
   Next columnCounter
Next rowCounter

' Return the string array
RangetoStringArray = stringValues

Set MSForms_DataObject = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
MSForms_DataObject.SetText RangetoStringArray.Value
MSForms_DataObject.PutInClipboard
Set MSForms_DataObject = Nothing
</code></pre>