If you want to be automatically update today’s day of the week then this article is for you. This article focus on updating user the current day of the week via msgbox in vba.
Question): I want a code to determine the day of the week.
We need to follow the below steps to launch VB editor
Sub TodaysDay()
Select Case DatePart("w", Date, vbMonday)
Case 1
MsgBox "Mon"
Case 2
MsgBox "Tue"
Case 3
MsgBox "Wed"
Case 4
MsgBox "Thur"
Case 5
MsgBox "Fri"
Case 6
MsgBox "Sat"
Case 7
MsgBox "Sun"
End Select
End Sub
Note: Today’s Date is June 5, 2015 i.e. Friday
“vbMonday” is used to return Monday as first day of the week; in case Sunday is the first day of the week then you need to use “vbSunday”
Sub TodaysDay()
Select Case DatePart("w", Date, vbMonday)
Case 1
MsgBox "Monday"
Case 2
MsgBox "Tuesday"
Case 3
MsgBox "Wednesday"
Case 4
MsgBox "Thursday"
Case 5
MsgBox "Friday"
Case 6
MsgBox "Saturday"
Case 7
MsgBox "Sunday"
End Select
End Sub
In this we can use VBA message box to notify user about the current day of the week.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.