View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Joe_Germany Joe_Germany is offline
external usenet poster
 
Posts: 25
Default Custom Function basic

Thax Toppers..

I got the result I wanted.. My FIRST custom function.. Im happy..
See if it is usefull..

I made this to add a number of working days on a given day..

---------

Function AddWorkDays(Date_St As Date, n As Integer) As Date

Dim WeekDay_St, n_Weekends, n_Shift As Integer

WeekDay_St = WorksheetFunction.WeekDay(Date_St, 2)
n_Weekends = WorksheetFunction.Floor((WeekDay_St + n - 2) / 5,
1)
n_Shift = n_Weekends * 2 + n - 1

AddWorkDays = Date_St + n_Shift

End Function

------
say A1 is the start date and A2 is the no of working day needed..

A1: 31/08/06
A2: 5

AddWorkDays(A1,A2) will give you 06/09/06

if A2 is 1, its the same day..
If A1 is a weekend and if A2 is 1, the out put is next monday..


Hope someone can use it..
suggessions / comments are most welcome

Bye.
Joe



Toppers wrote:
Yes ....in English ....


MsgBox Application.Round(123.467, 2)

Look in VBA help for all functions available.

HTH

"Joe_Germany" wrote:

Hello all..

I am trying to make a custom function.. I am using german Excel..
My qn is - Can we use the standard functions inside vb..

For eg, ABRUNDEN(x,y) is the function for Round(x,y)
can i use abounden(x,y) as a vb code while making the custom function..

If not is there any way we can access the standard functions while
making custom functions?

Thanks all
Joe