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

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -