View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
thomas donino thomas donino is offline
external usenet poster
 
Posts: 89
Default vba coding question

Rick, my prior reply was to my question as to whether or not there is a
function that returns the last day of a given month. Your code was for my
first post I guess. I was already instructed to use the =workday function,
which is working great.

"Rick Rothstein" wrote:

I think this will do what you want...

Function GetDate(D As Date) As Date
GetDate = D + (Weekday(D, vbMonday) 5) + (Weekday(D, vbMonday) 6)
GetDate = GetDate + IsHoliday(GetDate)
End Function

Note that I do not make use of your IsWeekend function in this code... I
only use your IsHoliday function. Also note those plus signs are all correct
(VB True values evaluate to -1, so adding them subtracts days).

--
Rick (MVP - Excel)


"thomas donino" wrote in message
...
I have a date in a cell which I need to check for whether or not it is a
weekend day or a holiday. I have a function to do each, my question is how
do
I construct the loop to check first if its a weekend day and if so run
again
to see if the day prior is a weekend day and then if that is also a
weekend
day to check if day prior again is a holiday. If it is, return the next
prior
day and if not then return that day. I already built the Isweekend and
Isholiday functions.

Thank you in advance