Link to home
Start Free TrialLog in
Avatar of Kiwi-123
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
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Take a look here.
ASKER CERTIFIED SOLUTION
Avatar of nutsch
nutsch
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial