VBA WEEKDAYNAME Function (Syntax + Example) - Excel ...
文章推薦指數: 80 %
The VBA WEEKDAYNAME function is listed under the date category of VBA functions. When you use it in a VBA code, it returns the day's (weekdays) name by ... SkiptocontentHome➜VBATutorial➜TopVBAFunctions➜VBAWEEKDAYNAMEFunction(Syntax+Example)TheVBAWEEKDAYNAMEfunctionislistedunderthedatecategoryofVBAfunctions.WhenyouuseitinaVBAcode,itreturnstheday’s(weekdays)namebyusingtheintegersuppliedasthedaynumber.Insimplewords,itreturnsthedaynameusingtheaday’snumberoftheweek(ranging1to7).TableofContentCloseSyntaxArgumentsExampleRelatedFunctionsSyntaxWeekdayName(Weekday,[Abbreviate],[FirstDayOfWeek])ArgumentsWeekday:Anintegertospecifythedayrangingfrom1to7.[Abbreviate]:Abooleanvaluetospecifyifyouneedafullnameofthemonthorabbreviatedname[ThisisanoptionalargumentandifomittedVBAtakesFALSEbydefault].UseTRUEforabbreviatedname(i.e.“Jan”,“Feb”,“Mar”,etc.)orFALSEforfullname(i.e.“January”,“February”,“March”,etc.)[FirstDayOfWeek]:Astringtodefinethefirstdayoftheweek[ThisisanoptionalargumentandifomittedVBAtakesvbSundaybydefault].vbUseSystemDayOfWeek–Asperthesystemsettings.vbSunday–SundayvbMonday–MondayvbTuesday–TuesdayvbWednesday–WednesdayvbThursday–ThursdayvbFriday–FridayvbSaturday–SaturdayExampleTopracticallyunderstandhowtouseVBAWEEKDAYNAMEfunction,youneedtogothroughthebelowexamplewherewehavewrittenavbacodebyusingit:Subexample_WEEKDAYNAME() Range("A1").Value=WeekdayName(1,"True",vbMonday) EndSubIntheabovecode,wehaveusedWEEKDAYNAMEandwehaveused1togetthefirstdayoftheweek,TRUEtogettheabbreviatedweekdayname,andvbMondaytosetMondayasthefirstdayoftheweek.Intheresult,wehaveMonincellB1.RelatedFunctionsDATE|DATEADD|DATEDIFF|DATEPART|DATESERIAL|DATEVALUE|DAY|MONTH|MONTHNAME|WEEKDAY|YEAR
延伸文章資訊
- 1VBA WeekdayName Function - Automate Excel
In the VBA Editor, you can type “WeekdayName(” to see the syntax for the WeekdayName Function: Th...
- 2vba get weekday name of date? UK date format issue - Stack ...
- 3VBA WeekdayName()函数 - 易百教程
VBA WeekdayName()函数 · 0 = vbUseSystemDayOfWeek - 使用国家语言支持(NLS)API设置. · 1 = vbSunday - 星期日 · 2 = v...
- 4VBA WeekDayName函數- VBA教學 - 極客書
WeekDay WeekDayName函數返回工作日指定日的名稱。 語法: WeekdayName ( weekday [, abbreviate [, firstdayofweek ]]) 參...
- 5MS Excel: How to use the WEEKDAYNAME Function (VBA)
The Microsoft Excel WEEKDAYNAME function returns a string representing the day of the week given ...