Home > OS >  Date of the dynamic display functions, requirements: 1, in the past year by year show; According to
Date of the dynamic display functions, requirements: 1, in the past year by year show; According to

Time:11-19

CodePudding user response:

 Sub x () 
For I=1 To Sheet1. UsedRange. Rows. Count
If Cells (I, 1)="" Then Exit the For
Dim datenow yearnow, col, monnow, QTR
Col=2
Datenow=CDate (Cells (I, 1))
Yearnow=Year (datenow)
For j=2011 To yearnow - 1
Cells (I, col)=CDate (j & amp; "/12/31")
Col=col + 1
Next j

Monnow=Month (datenow)
QTR=IIf (monnow Mod=0, 3 monnow, 3 * (monnow \ 3 + 1))

For j=3 To QTR Step 3
Cells (I, col)=DateAdd (" d ", 1, DateAdd (" M ", 1, CDate (yearnow & amp; "/" & amp; J & amp; "/1")))
Col=col + 1
Next j
Next
End Sub


  • Related