Excel VBA Weekday Function: The TimeValue function in VBA returns an integer (1 to 7), signifying the day of the week for the specified date.

Syntax

Parameter

Date (required) – This parameter represents a valid String interpretation of time.

FirstDayOfWeek (optional) – This parameter specifies the weekday that should be used as the first day of the week. The default value is set to vbUseSystemDayOfWeek.

It can take the following values:

  • vbUseSystemDayOfWeek – The first day of the week is as specified in your system settings
  • vbSunday – Sunday
  • vbMonday – Monday
  • vbTuesday – Tuesday
  • vbWednesday – Wednesday
  • vbThursday – Thursday
  • vbFriday – Friday
  • vbSaturday – Saturday

Return

This function returns an integer (1 to 7), signifying the day of the week for the specified date.

Example 1

Output

3

VBA Weekday Function

Example 2

Output

2

VBA Weekday Function

Example 3

Output

1

VBA Weekday Function

Example 4

Output

Tuesday

VBA Weekday Function

Pin It on Pinterest

Share This