excel vba - How to get the Day Name of Date?

雨燕双飞 提交于 2019-12-05 20:03:39

For your specific request, assuming your date string is formatted as your regional setings:

    sDayName = Format("11/01/2016", "dddd")

If you want the weekday for today:

    sDayName = Format(Date, "dddd")

If you want the weekday for any date in any regional settings

    sDayName = Format(DateSerial(2016, 11, 4), "dddd")
    'change 2016, 11, 4 for your year, month, day values

:)

kadrleyn

WEEKDAY Function can be used on this topic and in Vba Codes . For example:

Label2.Caption = WeekdayName(Weekday(TextBox2, 0), False, 0)

I used this function in when I created userform about date entry to active cell.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!