Copy paste values from one worksheet to another worksheet of the same workbook.

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,040
Office Version
  1. 2019
Platform
  1. Windows
Hello . How do I copy from worksheet named "Special" all data from Column A to Column G but starting from the 2nd Row down til the last data cell (in column A).
Next, paste this to a sheet named "Summary" just below last data cell available (in column A).

Will appreciate any help.
Thanks and regards,

Omair.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
try this:
VBA Code:
Sub test()
With Worksheets("Special")
lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
inarr = .Range(.Cells(2, 1), .Cells(lastrow, 7))
End With
With Worksheets("Summary")
 lastd = .Cells(Rows.Count, "A").End(xlUp).Row + 1
  .Range(.Cells(lastd, 1), .Cells(lastd + lastrow - 1, 7)) = inarr
End With

End Sub
 
Upvote 0
Solution
try this:
VBA Code:
Sub test()
With Worksheets("Special")
lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
inarr = .Range(.Cells(2, 1), .Cells(lastrow, 7))
End With
With Worksheets("Summary")
 lastd = .Cells(Rows.Count, "A").End(xlUp).Row + 1
  .Range(.Cells(lastd, 1), .Cells(lastd + lastrow - 1, 7)) = inarr
End With

End Sub

Thanks a lot offthelip, I owe you one.


(one little alteration at the second last line of your code and it work just fine.)

.Range(.Cells(lastd, 1), .Cells(lastd + lastrow - 2, 7)) = inarr
 
Upvote 0

Forum statistics

Threads
1,215,324
Messages
6,124,249
Members
449,149
Latest member
mwdbActuary

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