excel - Find first workday of current month -
i working on code establishes whether today first workday of month. if true piece of code run. code is:
if date = lastday - day(lastday) + 1 ' code run here end if the problem: seems referring last day of month, may 29.
here simple-minded way of getting first workday of month:
sub fwday() dim d1 date, day1txt string d1 = dateserial(year(date), month(date), 1) day1txt = format(d1, "dddd") if day1txt = "saturday" d1 = d1 + 2 if day1txt = "sunday" d1 = d1 + 1 msgbox d1 end sub you may need adjust day spelling based on regional settings.
Comments
Post a Comment