Hello and I need some help with defining a macro to do the following.
My excel file has 2 register; "export" and "archive".
At the end of each month I want to copy each line entry from register "export" that has a date stamp within that month and paste it into the register "archive" below the last entry. The challenge is that the copy/paste is a matrix (see below).
At the end of the macro I want to delete the copied data from the register "export" that has the date stamp within that month.
The actual month is defined with the data in cell "A30" in register "export".
There is an active-x button in register "export" that when "clicked" will run the macro.
This macro should do the following: each line in register "export" that has the date in column "E" that is within the month (eg. 01.11.-30.11.2017), it should copy each cell and paste each cell in register "archive* below the last entry. Each cell of the copied line will be pasted in a different column in the register "archive". The copy/paste matrix should be as follow:
Set up in register "export"
[TABLE="width: 600"]
<tbody>[TR]
[TD][TABLE="width: 600"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]State[/TD]
[TD]Typ[/TD]
[TD]Case1[/TD]
[TD]Case2[/TD]
[TD]Date[/TD]
[TD]Entry1[/TD]
[TD]Entry2[/TD]
[TD]Entry3[/TD]
[TD]Type[/TD]
[TD]Net[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]test1[/TD]
[TD]test2[/TD]
[TD]test3[/TD]
[TD]test4[/TD]
[TD="align: right"]30.11.2017[/TD]
[TD]test5[/TD]
[TD]test6[/TD]
[TD]test7[/TD]
[TD]test8[/TD]
[TD]test9[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Set up in register "archive"
[TABLE="width: 557"]
<tbody>[TR]
[TD][TABLE="width: 557"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[/TR]
[TR]
[TD]State[/TD]
[TD]Date[/TD]
[TD]Entry1[/TD]
[TD]Case2[/TD]
[TD]Type[/TD]
[TD]Net[/TD]
[TD]Entry2[/TD]
[TD]Case1[/TD]
[TD]Typ[/TD]
[TD]Entry3[/TD]
[/TR]
[TR]
[TD]test1[/TD]
[TD="align: right"]30.11.2017[/TD]
[TD]test8[/TD]
[TD]test4[/TD]
[TD]test7[/TD]
[TD]test9[/TD]
[TD]test6[/TD]
[TD]test3[/TD]
[TD]test2[/TD]
[TD]test5[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Thank you for your help with this macro. Kind regards, Marc
My excel file has 2 register; "export" and "archive".
At the end of each month I want to copy each line entry from register "export" that has a date stamp within that month and paste it into the register "archive" below the last entry. The challenge is that the copy/paste is a matrix (see below).
At the end of the macro I want to delete the copied data from the register "export" that has the date stamp within that month.
The actual month is defined with the data in cell "A30" in register "export".
There is an active-x button in register "export" that when "clicked" will run the macro.
This macro should do the following: each line in register "export" that has the date in column "E" that is within the month (eg. 01.11.-30.11.2017), it should copy each cell and paste each cell in register "archive* below the last entry. Each cell of the copied line will be pasted in a different column in the register "archive". The copy/paste matrix should be as follow:
- copy from register "export" column "A" and paste in register "archive" below last entry in column "A"
- copy from register "export" column "B" and paste in register "archive" below last entry in column "I"
- copy from register "export" column "C" and paste in register "archive" below last entry in column "H"
- copy from register "export" column "D" and paste in register "archive" below last entry in column "D"
- copy from register "export" column "E" and paste in register "archive" below last entry in column "B"
- copy from register "export" column "F" and paste in register "archive" below last entry in column "J"
- copy from register "export" column "G" and paste in register "archive" below last entry in column "G"
- copy from register "export" column "H" and paste in register "archive" below last entry in column "E"
- copy from register "export" column "I" and paste in register "archive" below last entry in column "C"
- copy from register "export" column "J" and paste in register "archive" below last entry in column "F"
Set up in register "export"
[TABLE="width: 600"]
<tbody>[TR]
[TD][TABLE="width: 600"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]State[/TD]
[TD]Typ[/TD]
[TD]Case1[/TD]
[TD]Case2[/TD]
[TD]Date[/TD]
[TD]Entry1[/TD]
[TD]Entry2[/TD]
[TD]Entry3[/TD]
[TD]Type[/TD]
[TD]Net[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]test1[/TD]
[TD]test2[/TD]
[TD]test3[/TD]
[TD]test4[/TD]
[TD="align: right"]30.11.2017[/TD]
[TD]test5[/TD]
[TD]test6[/TD]
[TD]test7[/TD]
[TD]test8[/TD]
[TD]test9[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Set up in register "archive"
[TABLE="width: 557"]
<tbody>[TR]
[TD][TABLE="width: 557"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[/TR]
[TR]
[TD]State[/TD]
[TD]Date[/TD]
[TD]Entry1[/TD]
[TD]Case2[/TD]
[TD]Type[/TD]
[TD]Net[/TD]
[TD]Entry2[/TD]
[TD]Case1[/TD]
[TD]Typ[/TD]
[TD]Entry3[/TD]
[/TR]
[TR]
[TD]test1[/TD]
[TD="align: right"]30.11.2017[/TD]
[TD]test8[/TD]
[TD]test4[/TD]
[TD]test7[/TD]
[TD]test9[/TD]
[TD]test6[/TD]
[TD]test3[/TD]
[TD]test2[/TD]
[TD]test5[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Thank you for your help with this macro. Kind regards, Marc
Last edited: