VBA: Copy/Paste without clipboard

BIGTONE559

Active Member
Joined
Apr 20, 2011
Messages
336
Greetings,

i've read a number of articles about methods for bypassing the clip board when copying and pasting. I wrote some test code however, when it pastes it only pastes the data in one cell not the entire range of cells that had data in them.

Code:
Sub CopyPaste()
Dim sh As Worksheet

For Each sh In Application.Worksheets
If sh.Index <> Worksheets.Count Then
Worksheets(3).Range("A500").End(xlUp).Offset(1, 0).Value = sh.Range("A1:L34").Value
End If
Next sh



End Sub

All help is appreciated
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
For the
.Value = .Value method, the source and destination ranges must be the same size

This is a MultiCell range (A1:L34)
But this is a single cell range
Worksheets(3).Range("A500").End(xlUp).Offset(1, 0)

Try
Code:
Sub CopyPaste()
Dim sh As Worksheet, Src As Range, Dst As Range
For Each sh In Application.Worksheets
    If sh.Index <> Worksheets.Count Then
        Set Src = sh.Range("A1:L34")
        Set Dst = Worksheets(3).Range("A500").End(xlUp).Offset(1, 0).Resize(Src.Rows.Count, Src.Columns.Count)
        Dst.Value = Src.Value
    End If
Next sh
End Sub
 
Upvote 0
Your source and destination ranges must be the same size, like this sample:

sheet1.Range("b1:B5").value = sheet1.Range("a1:a5").Value
 
Upvote 0
JonMo1Thanks!!!!


thanks for all the help it worked perfectly. never thought to use the properties you included.

Thanks a million
 
Upvote 0

Forum statistics

Threads
1,213,544
Messages
6,114,249
Members
448,556
Latest member
peterhess2002

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top