Range in worksheet1 Insert into worksheet2 from row 2

Status
Not open for further replies.

dufusgoofus

New Member
Joined
Feb 25, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
---------------
The Issue
---------------
  • Source workbook, wbSource, has worksheet wsSource
  • Destination workbook, wbDestination has worksheet wsDestination.
  • The code below works but I have to first find the first empty cell in wsDestination, then later sort dates in descending order.
  • Sorting in wsDestination takes time (there's a lot of data).
---------------
The Question
---------------
  • How can I insert row count from wsSource into wsDestination row 2 onwards?
    • Hoping that by adding blank rows in wsDestination will reduce time taken for macro to run and
    • Number of rows from wsSource varies.
Is there a way to get range from wsSource to insert into wsDestination from row 2 onwards, without using Copy and Paste?

With wsSource
LastRow = .Cells(Rows.Count, 1).End(xlUp).Row
LastCol = .Cells(Columns.Count).End(xlToLeft).Column
Set rgSource = .Range(.Cells(2, 1), .Cells(LastRow, LastCol))
End With
... ...
(open wbDestination)
Set rgDest = Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
rgDest.Resize(rgSource.Rows.Count, rgSource.Columns.Count).Value = rgSource.Value
Range("A:H").Sort Key1:=[D2], Order1:=xlDescending, Header:=xlYes
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Status
Not open for further replies.

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

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