Private Sub Worksheet_Change(ByVal Target As Range)
zr = Target.Row: zc = Target.Column
If zc = 1 And Cells(zr, 2) = "" Then
Dim lad, sfd As Date
sfd = Application.EoMonth(Date, -2) 'sfd means StartFromDate
lad = Application.Max(Columns(2), sfd) 'lad means LastActionDate
Cells(zr, 2) = lad + 1
End If
End Sub作者: lpk187 時間: 2015-9-16 16:59
For j = 1 To Cells(Rows.Count, 1).End(xlUp).Row Step dN '
For I = DateSerial(Year(Date), Month(Date) + 1, 1) To DateSerial(Year(Date), Month(Date) + 2, 0) '填寫日期
If Cells(r, 1) <> "" Then '遇到A欄有空白,就停止
Cells(r, 2) = Format(I, "m/ d")
r = r + 1
End If
Next
Next
End Sub
複製代碼
作者: 准提部林 時間: 2015-9-16 18:23
Sub TTDATE()
Dim D As Date, DC%
D = DateSerial(Year(Date), Month(Date) + 2, 0) '下月底
DC = Day(D) '下月天數
For i = 1 To [A65536].End(xlUp).Row
Cells(i, 2) = D - DC + 1 + (i - 1) Mod DC
Next i
End Sub作者: toromru 時間: 2015-9-18 17:11