Help to fill the last month of each quarter

nhnn1986

Board Regular
Joined
Oct 12, 2017
Messages
92
Hi all, I want to have VBA macro auto fill value year and month each quarter:
When I type in sheet(main).rane(A2) and run macro => sheet(data_result).range(C2) = sheet(main).rane(A2), range(D2).value = next quarter and continuously with range(G2), range(J2),range(M2)

It look like:
If sheet(main).range(A2) = 202012 or 202011 or 202010 then in sheet(data_result) (C2 = sheet(main).range(A2) .value, D2 = 202009, G2 = 202006, J2 = 202003 and M2 = 201912
Or If sheet(main).range(A2) = 202009 or 202008 or 202007 then in sheet(data_result) (C2 = sheet(main).range(A2) .value, D2 = 202006, G2 = 202003, J2 = 201912 and M2 = 201909
And so on

Monthly_quater.xlsx
ABCDEFGHIJKLMNO
1HeaderHeaderPerid1Perid 2ComparePerid 3ComparePerid 4ComparePerid 5Compare
2202012202009=C-D=E/D202006=C-G=H/G202003=C-J=K/J201912=C-M=N/M
Data_result
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,215,516
Messages
6,125,286
Members
449,218
Latest member
Excel Master

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