1
如果出生日期在當年還未被擊中,則該小組計算不正確。如果DOB是12/31/1950,它將計算DOB爲56,但這個人真的是55直到12/31。是否有可以添加的更新來適應此問題。我錯過了什麼錯誤?
Sub EE_DatedIf_ButtonC_()
Dim wb1 As Workbook
Dim i As Long
Dim LastRow1 As Long
Dim yrDiff As Long
Dim d1 As Date
Dim d2 As Date
Set wb1 = Workbooks("macro all client v.01.xlsm")
LastRow1 = wb1.Sheets("Carrier").range("F:F").Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
For i = 10 To LastRow1
d1 = wb1.Sheets("Carrier").Cells(8, 1)
d2 = wb1.Sheets("Carrier").Cells(i, 24)
yrDiff = DateDiff("yyyy", d2, d1)
wb1.Sheets("Carrier").Cells(i, 3) = yrDiff
Next i
End Sub
我日思365會更準確。更好的是,小時和8760 ... – TTT
@TTT我會在我的答案中包括。謝謝。 –
好的閏年調整。 :) – TTT