Day test question

P

Patrick C. Simonds

The code below ensures that the date selected (on Calendar1) is a Thursday
and works fine. The intent here to create an annual vacation book, and
because of how the book is printed it needs to start on a Thursday.
Calendar1 is set to show the month of January when it opens.

What I need now is some way to amend the code so that if January 1 does not
fall on a Thursday, that they can only select the Thursday prior to January
1.




Sub Thursday_Test()

Dim MyDate, MyWeekDay
MyDate = DVal '= Date selected on Calendar1
MyWeekDay = Weekday(MyDate)

If MyWeekDay = 5 Then
ActiveCell.Value = DVal
Unload Calendar

RenameWorksheets.Rename_Worksheets

Exit Sub

End If
Unload Calendar
WrongDay.Show

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top