VBA:创建每月日历。 Sub CalendarMaker() Unprotect sheet if had previous calendar to prevent error. ActiveSheet.Protect DrawingObjects:=False, Contents:=False, _ Scenarios:=False Prevent screen flashing while drawing calendar. Application.ScreenUpdating = False Set up error trapping. On Error GoTo MyErr...
.ColumnWidth =11.VerticalAlignment = xlCenter .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .Orientation = xlHorizontal .Font.Size =12.Font.Bold =True.RowHeight =20EndWith' Put days of week in a2:g2.Range("a2") ="Sunday"Range("b2") ="Monday"Range("c2") ="Tuesday"Range...
.ColumnWidth =11.VerticalAlignment = xlCenter .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .Orientation = xlHorizontal .Font.Size =12.Font.Bold =True.RowHeight =20EndWith' Put days of week in a2:g2.Range("a2") ="Sunday"Range("b2") ="Monday"Range("c2") ="Tuesday"Range...
The formula WEEKDAY returns a number between 1 and 7 that corresponds to a particular day of the week. With default settings, 1 = Sunday, 2 = Monday, 3 = Tuesday, 4 = Wednesday, 5 = Thursday, 6 = Friday and 7 = Saturday.
=WEEKDAY(DATE(2025, 1,1)) To use the day mapping other than the default Sun-Sat, enter an appropriate number in the second argument. For example, to start counting days from Monday, the formula is: =WEEKDAY(C4, 2) In the image below, all the formulas return the day of the week ...
=CHOOSE((WEEKDAY(B2)),”Sunday”,”Monday”,”Tuesday”,”Wednesday”,”Thursday”,”Friday”,”Saturday”) Like with the TEXT function above, you can then use autofill to drag the formula down to the remaining cells to get the rest of the day names for your dates. ...
=WEEKDAY(A1) If cell A1 contains a date like "18-Sep-2023" (Monday), the formula will return 2; or 3 if A1 contains "19-Sep-2023" (Tuesday). Convert calendar date to day of week If you prefer having theday names, not numbers, you can combine the WEEKDAY function with the TEXT...
1. The WEEKDAY function below returns 2. 12/22/2025 falls on a Monday.2. You can also use the TEXT function to display the day of the week.3. Or create a custom date format (dddd) to display the day of the week. Cell A1 still contains a date.NETWORKDAYS...
1. C4 is the date cell you will get day of the week based on. 2. If you want some specified the start day and end day of a week, such as starts on Monday and ends with Sunday, you can choose number 2 as the return_type in the formula. See screenshot: ...
12 Tuesday 1-7 Tuesday-Monday 14 Thursday 1-7 Thursday-Wednesday 15 Friday 1-7 Friday-Thursday 16 Saturday 1-7 Saturday-Friday 17 Sunday 1-7 Sunday-Saturday Example 1 – Basic Examples of WEEKDAY Function If the days are given in date format and do not need a return_type value, you ...