Hi-
I am wondering if anyone has code that will effectively mimic the Workday()
function in Excel. Specifically, I want to be able to get the date of the next
trading day while taking into consideration both weekends and holidays. I have
some embarassingly simple code below that generates a logical date, but it does
not consider weekends or holidays. Would greatly appreciate any help.
Thank you.
functionNextDay(M,D,YYYY)NumToStr(M,0) + "/"+ NumToStr(D+1,0) + "/"+
NumToStr(YYYY,0,False);if( StrLeft(Prelim,4)=="1/32")Prelim = "2/1/"+
StrRight(Prelim,4);if( StrLeft(Prelim,4)=="2/29"AND
StrRight(Prelim,4)!="2012")Prelim = "3/1/"+ StrRight(Prelim,4);if(
StrLeft(Prelim,4)=="2/30")Prelim = "3/1/"+ StrRight(Prelim,4);if(
StrLeft(Prelim,4)=="3/32")Prelim = "4/1/"+ StrRight(Prelim,4);if(
StrLeft(Prelim,4)=="4/31")Prelim = "5/1/"+ StrRight(Prelim,4);if(
StrLeft(Prelim,4)=="5/32")Prelim = "6/1/"+ StrRight(Prelim,4);if(
StrLeft(Prelim,4)=="6/31")Prelim = "7/1/"+ StrRight(Prelim,4);if(
StrLeft(Prelim,4)=="7/32")Prelim = "8/1/"+ StrRight(Prelim,4);if(
StrLeft(Prelim,4)=="8/32")Prelim = "9/1/"+ StrRight(Prelim,4);if(
StrLeft(Prelim,4)=="9/31")Prelim = "10/1/"+ StrRight(Prelim,4);if(
StrLeft(Prelim,5)=="10/32")Prelim = "11/1/"+ StrRight(Prelim,4);if(
StrLeft(Prelim,5)=="11/31")Prelim = "12/1/"+ StrRight(Prelim,4);if(
StrLeft(Prelim,5)=="12/32")Prelim = "1/1/"+
NumToStr(StrToNum(StrRight(Prelim,4))+1,0,False);returnPrelim;
{
Prelim =
}