I am trying to simplify the VBA below as there's too many selects and with the array of data being copied from one sheet to the other as the sheets get larger in size, I want to reduce the overhead and increase the speed it executes. It currently works, but isn't the cleanest.
The "TODAYS_DATA" tab contains the output of an Oracle SQL extraction that has been imported into Excel. What I want to do, is take that tabs content (from A2 across to the end and then down to capture the whole sheet), then paste it at the bottom of the tens of thousands of rows that exist in the "HISTORIC_DATA" tab already. I can then save the file and repeat this each day.
As I say, whilst this works, I am aware that there's no need to select cells and copy/cut/paste in this way is best avoided.
I have seen this as an alternative, but cannot get it to work no matter how I try and shoehorn it into what I already have.
Any pointers would be good as trying to tidy up my code as I go along.
Thanks all
The "TODAYS_DATA" tab contains the output of an Oracle SQL extraction that has been imported into Excel. What I want to do, is take that tabs content (from A2 across to the end and then down to capture the whole sheet), then paste it at the bottom of the tens of thousands of rows that exist in the "HISTORIC_DATA" tab already. I can then save the file and repeat this each day.
As I say, whilst this works, I am aware that there's no need to select cells and copy/cut/paste in this way is best avoided.
Code:
Sheets("TODAYS_DATA").Select
Range("A2").Select ' Using A2 as no need to copy of the heading row
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Cut
'Paste that copied data from the last working day and paste it into the Historic_Data tab
Sheets("HISTORIC_DATA").Select
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
Range("A1").Select
Code:
Range(ActiveCell, Cells(ActiveCell.End(xlDown).Row, ActiveCell.End(xlToRight).Column)).Value
Any pointers would be good as trying to tidy up my code as I go along.
Thanks all