VBA Function WEEKDAY - BetterSolutions.com

文章推薦指數: 80 %
投票人數:10人

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



請為這篇文章評分?