Kiwi-123
asked on
command button help
Sorry please can you help me list the 1st and last day of the month; at the moment I got the 1st monday and last friday.
Private Sub CommandButton1_Click()
Dim dtFirst As Date
Dim dtLast As Date
dtFirst = DateSerial(Year(Date), Month(Date), 1)
dtLast = DateSerial(Year(Date), Month(Date) + 1, 0)
Range("C2").Value = dtFirst + 6 - Weekday(dtFirst - 1, 3)
Range("C3").Value = dtLast + 1 - Weekday(dtLast + 1 - 6)
End Sub
Private Sub CommandButton1_Click()
Dim dtFirst As Date
Dim dtLast As Date
dtFirst = DateSerial(Year(Date), Month(Date), 1)
dtLast = DateSerial(Year(Date), Month(Date) + 1, 0)
Range("C2").Value = dtFirst + 6 - Weekday(dtFirst - 1, 3)
Range("C3").Value = dtLast + 1 - Weekday(dtLast + 1 - 6)
End Sub
Take a look here.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.