VBA Function WEEKDAY - BetterSolutions.com
文章推薦指數: 80 %
WEEKDAY(date, [firstdayofweek]) ... * If "firstdayofweek" is left blank, then 1 (vbSunday) is used. * If "firstdayofweek" = vbUseSystemDayOfWeek, this takes the ... HomeBetterSolutions.comOnlineDocumentationMicrosoftOfficeExcelMicrosoftOfficeWordVBAProgrammingC#ProgrammingJavaScriptProgrammingMicrosoftOfficeExcelWorkbooksWorksheetsRowsColumnsCellsRangesDataValidationDataAnalysisPivotTablesPowerQuerySearchExcel...FunctionsUserDefinedFormulasArrayFormulasReviewingTrackChangesNamedRangesConditionalFormatMicrosoftWordTablesChartsDatesTimesFormattingIllustrationsPageLayoutImportingXMLMicrosoftPowerPointRibbonOptionsShortcutKeysProtectionAdd-insMacrosTemplatesQuantFinanceMicrosoftOutlookMicrosoftOfficeExcelWorksheetFunctionsListRibbonTabsExplainedKeyboardShortcutKeysQuantitativeFinanceSearchExcel...VBAProgrammingCodeEditorBestPracticesMacrosSyntaxArraysCollectionsErrorHandlingDebuggingSearchVBA...DataTypesVariablesStringsNumbersDatesTextFilesDirectoriesXMLQuestionsFunctionsSubroutinesMsgBoxInputBoxUserformsControlsEventsDatabasesJSProgrammingRibbonOptionsShortcutKeysEnumerationsClassModulesReferencesWebServicesSQLC#ProgrammingVBAProgrammingCompleteFunctionsListRecordingMacrosSyntaxAndLoopsBestPracticesSearchVBA...BespokeDevelopmentOfficeAdd-inDevelopmentJavaScriptOfficeAdd-insVSTOandC#IntegrationMacrosandVBAProgrammingHighValueConsultancyGetInTouchVBA>FunctionsVBAProgrammingFunctionsWEEKDAYDates&TimesCompleteListAlphabetical-WIndex-WUpdated:02December202102December2021WEEKDAY(date,[firstdayofweek])Returnsthenumberrepresentingthedayoftheweekforagivendate(Integer).dateThedateyouwantthedayfor(Date).firstdayofweek(Optional)AvbDayOfWeekconstantthatspecifiesthefirstdayoftheweek(Integer):0=vbUseSystemDayOfWeek1=vbSunday(default)2=vbMonday3=vbTuesday4=vbWednesday5=vbThursday6=vbFriday7=vbSaturdayREMARKS*If"firstdayofweek"isleftblank,then1(vbSunday)isused.*If"firstdayofweek"=vbUseSystemDayOfWeek,thistakesthesettingfromtheControlPanel,Region.*IftheCalendarpropertysettingisGregorian,thereturnedintegerrepresentstheGregoriandayoftheweekforthedateargument.IfthecalendarisHijri,thereturnedintegerrepresentstheHijridayoftheweekforthedateargument.ForHijridates,theargumentnumberisanynumericexpressionthatcanrepresentadateand/ortimefrom1/1/100(GregorianAug2,718)through4/3/9666(GregorianDec31,9999).*YoucanusetheWEEKDAYNAMEfunctiontoreturnthedayoftheweekasastring.*TheequivalentExcelfunctionisApplication.WorksheetFunction.WEEKDAY*Theequivalent.NETfunctionisMicrosoft.VisualBasic.DateAndTime.Weekday*FortheMicrosoftdocumentationrefertodocs.microsoft.comDebug.PrintVBA.Format("06/07/2020","dddd")'MondayDebug.PrintWeekday(#06/07/2020#,vbDayOfWeek.vbMonday)'7Debug.PrintWeekday(#07/07/2020#,vbDayOfWeek.vbMonday)'2Debug.PrintWeekday(#08/07/2020#,vbDayOfWeek.vbMonday)'5Debug.PrintWeekday(#12/07/2020#,vbDayOfWeek.vbMonday)'1Debug.PrintWeekday(#06/07/2020#,vbDayOfWeek.vbSunday)'1Debug.PrintWeekday(#06/07/2020#,vbDayOfWeek.vbSunday)'1Debug.PrintWeekday(#06/07/2020#,vbDayOfWeek.vbMonday)'7/vbDayOfWeek.vbSaturdayDebug.PrintWeekday(#06/07/2020#,vbDayOfWeek.vbTuesday)'6/vbDayOfWeek.vbFridayDebug.PrintWeekday(#06/07/2020#,vbDayOfWeek.vbUseSystemDayOfWeek)'7/vbDayOfWeek.vbSaturdayDebug.PrintWeekday(VBA.Date)'2Debug.PrintWeekday(VBA.Date,vbDayOfWeek.vbMonday)'1Debug.PrintWeekday(VBA.Date,vbDayOfWeek.vbUseSystemDayOfWeek)'1Debug.PrintWeekday(VBA.Now,vbDayOfWeek.vbSunday)'1,runonaSundayDebug.PrintWeekday(VBA.Now,vbDayOfWeek.vbMonday)'1,runonaMonday©2021BetterSolutionsLimited.AllRightsReserved.©2021BetterSolutionsLimitedTop
延伸文章資訊
- 1Excel VBA Weekday Function - WallStreetMojo
The weekday function returns the provided date's day number in the week. For example, if you have...
- 2VBA WeekDay()函数 - 易百教程
VBA WeekDay()函数. WeekDay() 函数返回一个从 1 到 7 的整数,表示指定日期的星期几。 语法. Weekday(date[,firstdayofweek]). 参数. ...
- 3VBA Function WEEKDAY - BetterSolutions.com
WEEKDAY(date, [firstdayofweek]) ... * If "firstdayofweek" is left blank, then 1 (vbSunday) is use...
- 4VBA WEEKDAY Function (Syntax + Example) - Excel Champs
The VBA WEEKDAY function is listed under the date category of VBA functions. When you use it in a...
- 5VBA - WeekDay - Tutorialspoint
VBA - WeekDay, The WeekDay function returns an integer from 1 to 7 that represents the day of the...