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
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 | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | |||
1 | Header | Header | Perid1 | Perid 2 | Compare | Perid 3 | Compare | Perid 4 | Compare | Perid 5 | Compare | ||||||
2 | 202012 | 202009 | =C-D | =E/D | 202006 | =C-G | =H/G | 202003 | =C-J | =K/J | 201912 | =C-M | =N/M | ||||
Data_result |