• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Code to Indentify Weekdays and Weekends

mm3904

New Member
Hello - I would like to use a VBA that generates a "true" when a date falls on a weekend and a "false" signal if it is a weekday. I tried some of the codes listed online but none seemed to work properly. Any thoughts?
 
Something like this should work:

[pre]
Code:
Dim MyDate as Date
MyDate = Date 'Set this equal to today's date
If Weekday(MyDate, vbMonday) > 5 Then
'it's a weekend
Else
'it's a weekday
end if
[/pre]
 
Back
Top