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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Status
Not open for further replies.

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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