Is there a function input after a year, can return to that year how many days?
CodePudding user response:
Description is not good, I again to describe:I type in 2020, returned to a total of 2020 days,
CodePudding user response:
With prompt box input yearSub test ()
Dim s, yearstr
Yearstr=InputBox (" input date "& amp; CRH (10) & amp; "Input format" & amp; CRH (10) & amp; "2013", "then how many days")
S=DateDiff (" d ", yearstr & amp; "/1/1", yearstr & amp; "/12/31")
MsgBox s & amp; "Day"
End Sub
In the specified year cell input
Sub test2 ()
Dim s, s2
S=[a1]
If s=vbNullString Then
MsgBox "please enter a year in cell A1"
The Else
S2=DateDiff (" d ", "s & amp; "/1/1," s & amp; "/12/31")
End the If
(b1)=s2
End Sub