uj5u.com熱心網友回復:
Sub x()
For i = 1 To Sheet1.UsedRange.Rows.Count
If Cells(i, 1) = "" Then Exit 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 & "/12/31")
col = col + 1
Next j
monnow = Month(datenow)
qtr = IIf(monnow Mod 3 = 0, monnow, 3 * (monnow \ 3 + 1))
For j = 3 To qtr Step 3
Cells(i, col) = DateAdd("d", -1, DateAdd("M", 1, CDate(yearnow & "/" & j & "/1")))
col = col + 1
Next j
Next
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/17117.html
