dufusgoofus
New Member
- Joined
- Feb 25, 2024
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
---------------
The Issue
---------------
The Question
---------------
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
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.
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