Allow datapicker to only allow Sunday dates to be selected RRS feed

  • Question

  • Is it possible to limit the users selection to just Sunday dates?

    If so what would be the best approach?

    Thank you

    Thursday, April 30, 2015 2:23 PM


  • Hi

    This macro should do what you're asking.

    Private Sub DTPicker1_CloseUp()
        Dim MyDate As Date, MyWeekDay As Integer
        MyDate = DTPicker1.Value
        MyWeekDay = Weekday(MyDate)
        If MyWeekDay <> 1 Then
            MsgBox "You must select a Sunday only"
            Range("A3") = DTPicker1.Value
            Unload Me
        End If

    End Sub

    A made a sample file with that macro at the link below.


    If that answered your question, please mark the post "Answered"


    Thursday, April 30, 2015 10:18 PM