WeekDay
Using the WEEKDAY Function
In this tutorial you will learn how to use the WEEKDAY Function.
The WEEKDAY function returns a Variant (Integer) containing a whole number representing the day of the week.
=WEEKDAY( date [, firstdayofweek] )
date a value that represents a valid date, be that numeric or string also.
firstdayofweek a constant specifying the first day of the week.
firstdayofweek
Constant | Value | Description |
vbUseSystem | 0 | Use the NLS API setting. |
vbSunday | 1 | Sunday (default) |
vbMonday | 2 | Monday |
vbTuesday | 3 | Tuesday |
vbWednesday | 4 | Wednesday |
vbThursday | 5 | Thursday |
vbFriday | 6 | Friday |
vbSaturday | 7 | Saturday |
Return Values
Constant | Value | Description |
vbSunday | 1 | Sunday |
vbMonday | 2 | Monday |
vbTuesday | 3 | Tuesday |
vbWednesday | 4 | Wednesday |
vbThursday | 5 | Thursday |
vbFriday | 6 | Friday |
vbSaturday | 7 | Saturday |
The result is 6.
UK Date Format
FORM
In a Form you could set the Default Value of a Textbox to
=WEEKDAY(#2/11/2012#)
VBA
In a Form add a TEXTBOX control and rename it "txtWeekDay", then you could add the following in the Load Event.
Private Sub Form_Load()
txtWeekDay = WeekDay(#2/11/2012#)
End Sub
Course
Want to learn more? Request this via the contact form.
Search
You can find more about this by searching the website.
By: Alex Hedley
Click here to sign up for more FREE tips
|