Hi all,
I have a report that pulls data from 4 table (2009,2010,2011 & 2012) and runs a macro to pull them into one 'combined' table.
A series of pivot tables feed from this combined sheet.
I need to get the macro to paste the 2009 data, then find the next blank row and paste the 2010 data under that and so on...
I have been using
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
to find the next row, but all that is happening is that I am getting four rows of 2009 data and all 2012 data then. There should be about 20,000 rows of data for each year.
Here is the code I have been using - as you will see, my knowledge of VBA is quite small. Any help will be greatly appreciated.
Thanks!
Sheets("Combined").Select
Range("A1").Select
Application.Goto Reference:="Table_Query_from_STReports_19"
Selection.Copy
Sheets("Combined").Select
ActiveSheet.Paste
Sheets("Data2009").Select
ActiveWindow.SmallScroll Down:=-3
Application.Goto Reference:="Table_Query_from_STReports_18"
Application.CutCopyMode = False
Selection.Copy
Sheets("Combined").Select
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
Application.Goto Reference:="Table_Query_from_STReports_1"
Application.CutCopyMode = False
Selection.Copy
Sheets("Combined").Select
Range("A1").Select
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
Application.Goto Reference:="Table_Query_from_STReports_110"
Selection.Copy
Sheets("Combined").Select
Range("A1").Select
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
I have a report that pulls data from 4 table (2009,2010,2011 & 2012) and runs a macro to pull them into one 'combined' table.
A series of pivot tables feed from this combined sheet.
I need to get the macro to paste the 2009 data, then find the next blank row and paste the 2010 data under that and so on...
I have been using
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
to find the next row, but all that is happening is that I am getting four rows of 2009 data and all 2012 data then. There should be about 20,000 rows of data for each year.
Here is the code I have been using - as you will see, my knowledge of VBA is quite small. Any help will be greatly appreciated.
Thanks!
Sheets("Combined").Select
Range("A1").Select
Application.Goto Reference:="Table_Query_from_STReports_19"
Selection.Copy
Sheets("Combined").Select
ActiveSheet.Paste
Sheets("Data2009").Select
ActiveWindow.SmallScroll Down:=-3
Application.Goto Reference:="Table_Query_from_STReports_18"
Application.CutCopyMode = False
Selection.Copy
Sheets("Combined").Select
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
Application.Goto Reference:="Table_Query_from_STReports_1"
Application.CutCopyMode = False
Selection.Copy
Sheets("Combined").Select
Range("A1").Select
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
Application.Goto Reference:="Table_Query_from_STReports_110"
Selection.Copy
Sheets("Combined").Select
Range("A1").Select
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste