Save this function in a standard module:
Function myWorkDay(myDate As Date, AddDays, LeaveDay)
If AddDays = 0 Then
myWorkDay = myDate
Exit Function
End If
Select Case LeaveDay
Case "Sunday"
LD = 1
Case "Monday"
LD = 2
Case "Tuesday"
LD = 3
Case "Wednesday"
LD = 4
Case "Thursday"
LD = 5
Case "Friday"
LD = 6
Case "Saturday"
LD = 7
End Select
i = 1
Do While i <= AddDays
myWorkDay = myDate + i
If WorksheetFunction.Weekday(myWorkDay) = LD Then
AddDays = AddDays + 1
End If
i = i + 1
Loop
End Function
And use it as follows:
=myWorkDay(A1,B1,"Thursday")
where A1 has your start date, and B1 has the number of days you want to add.
Mangesh
"pankaj_zen" wrote in message
...
Hi all,
i have a unique problem.
here we have thursdays as week ends ( sat & sundays are working days).
Now what i want to do is in anexcel sheet if i enter say for example
enter 24 may which is tuesday in any of the cells & digit 5 in another
cell, when i add these two i should get 30 may i.e it should jump
thursday my weekly off.
the number can be any thing from1 to 70.
Can any one please help me in this regard?
--
pankaj_zen
------------------------------------------------------------------------
pankaj_zen's Profile: http://www.officehelp.in/member.php?userid=42
View this thread: http://www.officehelp.in/showthread.php?t=650962
Visit - http://www.officehelp.in |
http://www.officehelp.in/index/index.php/