VBA WEEKDAYNAME Function - ExcelFunctions.net
文章推薦指數: 80 %
The VBA WeekdayName Function returns a string containing the weekday name, for a supplied integer representation of a weekday. ExcelFunctions.netSearchSite: + Home»VBA-Functions»VBA-WeekdayName-FunctionTheVBAWeekdayNameFunction RelatedFunction:VBAWeekdayDescriptionTheVBAWeekdayNameFunctionreturnsastringcontainingtheweekdayname,forasuppliedintegerrepresentationofaweekday.Thesyntaxofthefunctionis:WeekdayName(Weekday,[Abbreviate],[FirstDayOfWeek])Wherethefunctionargumentsare:Weekday-Aninteger,between1and7,representingthedayoftheweek.(Notethattheweekdaythatisrepresentedbyeachintegervaluedependsonthevalueofthe[FirstDayOfWeek]argument).[Abbreviate]-AnoptionalBooleanargumentthatspecifieswhetherthereturnedweekdaynameshouldbeabbreviated.Thiscanhavethevalue:True-Returnabbreviatedweekdayname(i.e."Sun","Mon","Tue",etc.)False-Returnfullweekdayname(i.e."Sunday","Monday","Tuesday",etc.)Ifthe[Abbreviate]argumentisomitted,itissettothedefaultvalueFalse.[FirstDayOfWeek]-AnoptionalFirstDayOfWeekenumerationvalue,specifyingtheweekdaythatshouldbeusedasthefirstdayoftheweek.Thiscanhaveanyofthefollowingvalues:vbUseSystemDayOfWeek-ThefirstdayoftheweekisasspecifiedinyoursystemsettingsvbSunday-SundayvbMonday-MondayvbTuesday-TuesdayvbWednesday-WednesdayvbThursday-ThursdayvbFriday-FridayvbSaturday-SaturdayIfomitted,the[FirstDayOfWeek]argumentusesthedefaultvaluevbSunday.VBAWeekdayNameFunctionExamplesExample1-ReturntheWeekdayNameforaGivenWeekdayNumber'Returntheweekdaynameforweekdaynumber1'(firstdayofweeksettodifferentvalues)Dimwkday1AsStringDimwkday2AsStringDimwkday3AsStringwkday1=WeekdayName(1)'wkday1isnowequaltothestring"Sunday".wkday2=WeekdayName(1,True)'wkday2isnowequaltothestring"Sun".wkday3=WeekdayName(1,True,vbMonday)'wkday3isnowequaltothestring"Mon".Notethat,intheaboveexamples:InthefirsttwocallstotheWeekdayNamefunction,the[FirstDayOfWeek]argumentisomitted.ThisisthereforesettothedefaultvaluevbSunday(i.e.weekdaynumber1isSunday).InthethirdcalltotheWeekdayNamefunction,the[FirstDayOfWeek]issettovbMonday(i.e.weekdaynumber1isMonday).Therefore,afterrunningtheexamplecode,thevariableswkday1,wkday2andwkday3areequaltotheStrings"Sunday","Sun"and"Mon"respectively.Example2-ReturntheWeekdayNameforaGivenDate'Returntheweekdaynameforthedate12/31/2015DimwkdayAsStringwkday=WeekdayName(Weekday(#12/31/2015#))'Thevariablewkdaynowequals"Thursday".TheaboveVBAcodecombinestheWeekdayNamefunctionwiththeWeekdayfunction,toreturntheweekdaynameforthedate12/31/2015.Therefore,afterrunningtheaboveVBAcode,thevariablewkdayisequaltotheString"Thursday". ReturntotheVBAFunctionsPageReturntotheExcelVBATutorialPageHomeBasicExcelBuilt-InExcelFunctions ▾ListofAllExcelFunctionsTextFunctionsLogicalFunctionsInformationFunctionsDate&TimeFunctionsLookup&ReferenceFunctionsMathFunctionsStatisticalFunctionsDatabaseFunctionsFinancialFunctionsEngineeringFunctionsExcel2019NewFunctionsExcel2016NewFunctionsExcelVlookupTutorialPivotTableTutorialExcelFormulasArrayFormulasAccountinginExcelTips&TricksCommonExcelErrorsExcelTemplatesExcelMacrosExcelVBATutorialBuilt-InVBAFunctionsExcel2003vs2007 Disclaimer PrivacyPolicy CookiesPolicyCopyright©2008-2021ExcelFunctions.net
延伸文章資訊
- 1VBA WEEKDAYNAME Function - ExcelFunctions.net
The VBA WeekdayName Function returns a string containing the weekday name, for a supplied integer...
- 2VBA WeekdayName()函数 - 易百教程
VBA WeekdayName()函数 · 0 = vbUseSystemDayOfWeek - 使用国家语言支持(NLS)API设置. · 1 = vbSunday - 星期日 · 2 = v...
- 3WeekdayName 函數(Visual Basic for Applications) - Microsoft ...
支援和意見反應. 有關於Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導, ...
- 4VBA - WeekDay Name - Tutorialspoint
VBA - WeekDay Name ... The WeekDayName function returns the name of the weekday for the specified...
- 5VBA WEEKDAYNAME Function (Syntax + Example) - Excel ...
The VBA WEEKDAYNAME function is listed under the date category of VBA functions. When you use it ...