copy the first two columns and the last column from sheet to next sheet based on current month

tubrak

Board Regular
Joined
May 30, 2021
Messages
218
Office Version
  1. 2019
Platform
  1. Windows
Hi experts,
I need macro to populated data from the last sheet contains data for columns A,B and the last column(last column will be change in location dynamically in every sheet ) to next sheet in column A,B,C. the column C = last column from last sheet . the next sheet should add by macro based on current month , the sheet name should be STOCK_ & current month
example : STOCK_FEB, STOCK_MAR ...... , but if I have current month every time when run the macro should not repeat adding the same sheet for the same month just replace data for the sheet has already added for the month is relating of it
so in STOCK sheet should copy data from columns A,B and the last column will be column(H) to STOCK_JAN sheet based on current month , if the current month is not JAN then will not add STOCK_JAN sheet and copy data from STOCK sheet, but if the current month is JAN then will add STOCK_JAN sheet and copy data from STOCK sheet . and if every time run the macro and the current month is JAN as example then just replace data without repeat adding sheet for the month like STOCK_JAN(1).
. after copy to STOCK_JAN sheet will copy data from STOCK_JAN sheet to STOCK_FEB sheet with the same condition and so on for every current month ,

TT.xlsm
ABCDEFGH
1S.NITEMQTY01/12/202302/12/202303/12/202304/12/202305/12/2023
21CTR 12-200M45 MM 123H K/L12.0010.0012.0010.0022.00
32CCTR 12-200M45 MM 123H K/L13.0011.0013.0020.0023.00
43TR 200M45MM LK H K/L14.0012.0014.0030.0024.00
54TR 200M451 NMM LK H K/L15.0013.0015.0040.0025.00
65TTR 12200S45 MN 12316.0014.0016.0050.0026.00
76TR 1425/148V MN 123H K/L17.0015.0017.0060.0027.00
87TR 200M45 MM 123H K/L SS18.0016.0018.0070.0028.00
98TR 2.5M100* 123H K/L19.0017.0019.0080.0029.00
109TR 2.5M100**123H K/L20.0018.0020.0090.0030.00
1110TRMN 22.5M100* 123H K/L21.0019.0021.00100.0031.00
1211TTRM 12200S45 MN 123422.0020.0022.00110.0032.00
1312TTRR 1200S45 MN 12323.0021.0023.00120.0033.00
1413TR 1200M45MM LK H K/L24.0022.0024.00130.0034.00
1514BTR-100***8 RRT-DE3423025.0023.0025.00140.0035.00
1615BTR-100***8 RRT-DE3423126.0024.0026.00150.0036.00
1716BTR-100***8 RRT-DE3423227.0025.0027.00160.0037.00
1817BTR-100***8 RRT-DE3423328.0026.0028.00170.0038.00
1918BTR-100***8 RRT-DE3423429.0027.0029.00180.0039.00
2019TR 2.5M100**123H K/LM30.0028.0030.00190.0040.00
2120VMTR 1200S45 MN 12331.0029.0031.00200.0041.00
2221CCMTR 12-200M45 MM 123H K/L32.0030.0032.00210.0042.00
2322CCMTR 12-200M45 MM-20033.0031.0033.00220.0043.00
STOCK


TT.xlsm
ABCDEFGHIJKL
1S.NITEMQTY08/01/202409/01/202410/01/202411/01/202412/01/202413/01/202414/01/202415/01/202416/01/2024
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
STOCK_JAN



TT.xlsm
ABCDEFGHIJKL
1S.NITEMQTY08/02/202410/02/202411/02/202411/02/202412/02/202413/02/202414/02/202415/02/202416/02/2024
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
STOCK_FEB



TT.xlsm
ABCDEFGHIJKLM
1S.NITEMQTY11/03/202412/03/202413/03/202414/03/202415/03/202416/03/202417/03/202418/03/202419/03/202420/03/2024
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
STOCK_MAR


result in STOCK_JAN if the current month is JAN sheet when run the macro


[
TT.xlsm
ABCDEFGHIJKL
1S.NITEMQTY08/01/202409/01/202410/01/202411/01/202412/01/202413/01/202414/01/202415/01/202416/01/2024
21CTR 12-200M45 MM 123H K/L22.00
32CCTR 12-200M45 MM 123H K/L23.00
43TR 200M45MM LK H K/L24.00
54TR 200M451 NMM LK H K/L25.00
65TTR 12200S45 MN 12326.00
76TR 1425/148V MN 123H K/L27.00
87TR 200M45 MM 123H K/L SS28.00
98TR 2.5M100* 123H K/L29.00
109TR 2.5M100**123H K/L30.00
1110TRMN 22.5M100* 123H K/L31.00
1211TTRM 12200S45 MN 123432.00
1312TTRR 1200S45 MN 12333.00
1413TR 1200M45MM LK H K/L34.00
1514BTR-100***8 RRT-DE3423035.00
1615BTR-100***8 RRT-DE3423136.00
1716BTR-100***8 RRT-DE3423237.00
1817BTR-100***8 RRT-DE3423338.00
1918BTR-100***8 RRT-DE3423439.00
2019TR 2.5M100**123H K/LM40.00
2120VMTR 1200S45 MN 12341.00
2221CCMTR 12-200M45 MM 123H K/L42.00
2322CCMTR 12-200M45 MM-20043.00
STOCK_JAN

and if fill others columns in STOCK_JAN sheet will copy to next sheet STOCK_FEB if the current month is FEB like this
TT.xlsm
ABCDEFGHIJKL
1S.NITEMQTY08/01/202409/01/202410/01/202411/01/202412/01/202413/01/202414/01/202415/01/202416/01/2024
21CTR 12-200M45 MM 123H K/L22.0023.0020.00
32CCTR 12-200M45 MM 123H K/L23.0010.0030.00
43TR 200M45MM LK H K/L24.0012.0040.00
54TR 200M451 NMM LK H K/L25.0014.0050.00
65TTR 12200S45 MN 12326.0016.0060.00
76TR 1425/148V MN 123H K/L27.0018.0070.00
87TR 200M45 MM 123H K/L SS28.0020.0080.00
98TR 2.5M100* 123H K/L29.0022.0090.00
109TR 2.5M100**123H K/L30.0024.00100.00
1110TRMN 22.5M100* 123H K/L31.0026.00110.00
1211TTRM 12200S45 MN 123432.0028.00120.00
1312TTRR 1200S45 MN 12333.0030.00130.00
1413TR 1200M45MM LK H K/L34.0032.00140.00
1514BTR-100***8 RRT-DE3423035.0034.00150.00
1615BTR-100***8 RRT-DE3423136.0036.00160.00
1716BTR-100***8 RRT-DE3423237.0038.00170.00
1817BTR-100***8 RRT-DE3423338.0040.00180.00
1918BTR-100***8 RRT-DE3423439.0042.00190.00
2019TR 2.5M100**123H K/LM40.0044.00200.00
2120VMTR 1200S45 MN 12341.0046.00210.00
2221CCMTR 12-200M45 MM 123H K/L42.0048.00220.00
2322CCMTR 12-200M45 MM-20043.0050.00230.00
STOCK_JAN

the result in STOCK_FEB sheet when run macro again like this


TT.xlsm
ABCDEFGHIJKL
1S.NITEMQTY08/02/202410/02/202411/02/202411/02/202412/02/202413/02/202414/02/202415/02/202416/02/2024
21CTR 12-200M45 MM 123H K/L20.00
32CCTR 12-200M45 MM 123H K/L30.00
43TR 200M45MM LK H K/L40.00
54TR 200M451 NMM LK H K/L50.00
65TTR 12200S45 MN 12360.00
76TR 1425/148V MN 123H K/L70.00
87TR 200M45 MM 123H K/L SS80.00
98TR 2.5M100* 123H K/L90.00
109TR 2.5M100**123H K/L100.00
1110TRMN 22.5M100* 123H K/L110.00
1211TTRM 12200S45 MN 1234120.00
1312TTRR 1200S45 MN 123130.00
1413TR 1200M45MM LK H K/L140.00
1514BTR-100***8 RRT-DE34230150.00
1615BTR-100***8 RRT-DE34231160.00
1716BTR-100***8 RRT-DE34232170.00
1817BTR-100***8 RRT-DE34233180.00
1918BTR-100***8 RRT-DE34234190.00
2019TR 2.5M100**123H K/LM200.00
2120VMTR 1200S45 MN 123210.00
2221CCMTR 12-200M45 MM 123H K/L220.00
2322CCMTR 12-200M45 MM-200230.00
STOCK_FEB

and if the current month is MAR then will copy from STOCK_FEB sheet and add MAR sheet like this
TT.xlsm
ABCDEFGHIJKLM
1S.NITEMQTY11/03/202412/03/202413/03/202414/03/202415/03/202416/03/202417/03/202418/03/202419/03/202420/03/2024
21CTR 12-200M45 MM 123H K/L20.00
32CCTR 12-200M45 MM 123H K/L30.00
43TR 200M45MM LK H K/L40.00
54TR 200M451 NMM LK H K/L50.00
65TTR 12200S45 MN 12360.00
76TR 1425/148V MN 123H K/L70.00
87TR 200M45 MM 123H K/L SS80.00
98TR 2.5M100* 123H K/L90.00
109TR 2.5M100**123H K/L100.00
1110TRMN 22.5M100* 123H K/L110.00
1211TTRM 12200S45 MN 1234120.00
1312TTRR 1200S45 MN 123130.00
1413TR 1200M45MM LK H K/L140.00
1514BTR-100***8 RRT-DE34230150.00
1615BTR-100***8 RRT-DE34231160.00
1716BTR-100***8 RRT-DE34232170.00
1817BTR-100***8 RRT-DE34233180.00
1918BTR-100***8 RRT-DE34234190.00
2019TR 2.5M100**123H K/LM200.00
2120VMTR 1200S45 MN 123210.00
2221CCMTR 12-200M45 MM 123H K/L220.00
2322CCMTR 12-200M45 MM-200230.00
STOCK_MAR



I hope finding solution from experts soon
thanks.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: populate report from sheet to next sheet based on current month
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
sorry about it .
this is the only forum is Cross posted .
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
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