Public Function YearStart(WhichYear As Integer) As Date Dim WeekDay As Integer Dim NewYear As Date NewYear =DateSerial(WhichYear, 1, 1) WeekDay =(NewYear - 2) Mod 7 If WeekDay < 4 Then YearStart = NewYear - WeekDay Else YearStart = NewYear - WeekDay + 7 End If End Function ...
WEEKDAYNAME返回用汉字表示的星期数 WeekdayName (weekday、abbreviate、firstdayofweek) WeekdayName 函数语法包含以下部分: firstdayofweek 参数可具有下列值: DATEPART返回某个日期具体属于哪一年、哪一月、哪一天、哪个季度等等。 DatePart (interval, date, [ firstdayofweek, [ firstweekofyear ]]) DatePart 函数语法...
Day(date) 返回一个Variant (Integer),其值为1 到31 之间的整数,表示一个月中的某一日 Month(date) 返回一个Variant (Integer),其值为1 到12 之间的整数,表示一年中的某月 Year(date) 返回Variant (Integer),包含表示年份的整数。 Weekday(date, [firstdayofweek]) 返回一个Variant (Integer),包含一个整数...
Day(date)返回一个 Variant (Integer),其值为 1 到 31 之间的整数,表示一个月中的某一日。 Month(date) 返回一个 Variant (Integer),其值为 1 到 12 之间的整数,表示一年中的某月。 Year(date) 返回 Variant (Integer),包含表示年份的整数。 Weekday(date, [firstdayofweek]) 返回一个 Variant (Integer...
Weekday(Date, [FirstDayOfWeek]) Arguments Date: A valid date for which you want to get the weekday. [FirstDayOfWeek]: A string to define the first day of the week [This is an optional argument and if omitted VBA takes vbSunday by default]. ...
Weekday(date, [firstdayofweek]) - 返回一个 Variant (Integer),包含一个整数,代表某个日期是星期几。 其它常用函数: Shell - 运行一个可执行的程序。 InputBox - 这个太熟悉了,简单输入对话框。这个需要注意与Application.InputBox(更强大,内置容错处理,选择取消后返回false)区分,而这个函数不含有容错处理,而且...
ActiveSheet.[B1].Value="星期"& disp(Weekday(DateStr, vbMonday))'设置单元格行列宽高自适应ActiveSheet.[A1].Columns.AutoFit ActiveSheet.[A1].Rows.AutoFit ActiveSheet.[B1].Columns.AutoFit ActiveSheet.[B1].Rows.AutoFitNextNextSheets(OriginSheet).DeleteOnErrorResumeNextApplication.DisplayAlerts=TrueEnd Su...
To determine the weekday of a date (from 1 to 7) or display it as a text format (Monday-Sunday, MON-SUN, M-S, etc.), there are several options available.To obtain the weekday number of a date (from 1 to 7), simply use the Weekday function:Sub example() dateTest = CDate("...
tod_secs As Long tod_hunds As Long tod_timezone As Long tod_tinterval As Long tod_day As Long tod_month As Long tod_year As Long tod_weekday As Long End Type Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory"...
Ronald - the function to use here is the WEEKDAY function which will return a value of 1-7 May I suggest that you have a look in the excel help file as a lot of the questions you have asked recently can be found very easily within there Rgds Geoff "Some cause happiness wherever...