Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel,microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it possible to use VBA functions in a worksheet? I'd like to use the Dateadd() function on a
worksheet. Jeff |
#2
![]()
Posted to microsoft.public.excel,microsoft.public.excel.programming
|
|||
|
|||
![]()
Jeff,
You don't need it. Try this as a formula: =NOW()+1 Robin Hammond www.enhanceddatasystems.com "Jeff" wrote in message ... Is it possible to use VBA functions in a worksheet? I'd like to use the Dateadd() function on a worksheet. Jeff |
#3
![]()
Posted to microsoft.public.excel,microsoft.public.excel.programming
|
|||
|
|||
![]()
mmm, that won't work. I was trying to calculate the age of a list of people given their date of
birth. I ended up using some year, month, and day functions. Assuming the date of birth is in column A, this should calculate the correct age to the day =(YEAR(TODAY()) - YEAR(A1)) - ((MONTH(TODAY())*100 + DAY(TODAY())) < (MONTH(A1)*100 + DAY(A1))) If anyone knows a better way to do this please post it. I just wanted a formula I could drag down a list of birth dates without writing a VBA procedure. Jeff "Robin Hammond" wrote in message ... Jeff, You don't need it. Try this as a formula: =NOW()+1 Robin Hammond www.enhanceddatasystems.com "Jeff" wrote in message ... Is it possible to use VBA functions in a worksheet? I'd like to use the Dateadd() function on a worksheet. Jeff |
#4
![]()
Posted to microsoft.public.excel,microsoft.public.excel.programming
|
|||
|
|||
![]()
Jeff -
... I was trying to calculate the age of a list of people given their date of birth. ... < You will likely find some useful techniques he http://www.cpearson.com/excel/datetime.htm - Mike www.mikemiddleton.com |
#5
![]()
Posted to microsoft.public.excel,microsoft.public.excel.programming
|
|||
|
|||
![]()
Sounds like you need DateDif. It isn't documented by MS for some reason, but
Chip Pearson has a page on it at http://www.cpearson.com/excel/datedif.htm -- HTH RP (remove nothere from the email address if mailing direct) "Jeff" wrote in message ... mmm, that won't work. I was trying to calculate the age of a list of people given their date of birth. I ended up using some year, month, and day functions. Assuming the date of birth is in column A, this should calculate the correct age to the day =(YEAR(TODAY()) - YEAR(A1)) - ((MONTH(TODAY())*100 + DAY(TODAY())) < (MONTH(A1)*100 + DAY(A1))) If anyone knows a better way to do this please post it. I just wanted a formula I could drag down a list of birth dates without writing a VBA procedure. Jeff "Robin Hammond" wrote in message ... Jeff, You don't need it. Try this as a formula: =NOW()+1 Robin Hammond www.enhanceddatasystems.com "Jeff" wrote in message ... Is it possible to use VBA functions in a worksheet? I'd like to use the Dateadd() function on a worksheet. Jeff |
#6
![]()
Posted to microsoft.public.excel.programming,microsoft.public.excel
|
|||
|
|||
![]()
You can create a user defined function.
Public Function MyDateAdd(arg1, arg2, arg3, arg4) as date MyDateAdd = datadd(arg1, arg2, arg3, arg4) end function -- HTH... Jim Thomlinson "Jeff" wrote: Is it possible to use VBA functions in a worksheet? I'd like to use the Dateadd() function on a worksheet. Jeff |
#7
![]()
Posted to microsoft.public.excel.programming,microsoft.public.excel
|
|||
|
|||
![]()
Please answer the question: IS IT POSSIBLE TO USE VBA FUNCTIONS IN A
WORKSHEET. Everyone has focused on the use of the DateAdd function, but there are hundreds of other VBA functions that are not supported by worksheet functions. Jim Thomlinson came the closest - create a user-defined function. But then, what magic incantations do I have to invoke to use it in a cell formula? Thanks. -- Ted "Jeff" wrote: Is it possible to use VBA functions in a worksheet? I'd like to use the Dateadd() function on a worksheet. Jeff |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Jim Thomlinson came the closest - create a user-defined function. But then, what magic incantations do I have to invoke to use it in a cell formula? Thanks." If you put the code in a regular module in the desired worksheet, or in an add-in if you want the function available to all/several worksheets, you call the function like you would any other worksheet function =mydateadd(arg1,arg2,arg3,arg4) -- MrShorty ------------------------------------------------------------------------ MrShorty's Profile: http://www.excelforum.com/member.php...o&userid=22181 View this thread: http://www.excelforum.com/showthread...hreadid=490940 |
#9
![]()
Posted to microsoft.public.excel.programming,microsoft.public.excel
|
|||
|
|||
![]()
Sorry, if we think it is better to use worksheet functions we will say so.
That is our prerogative. If w/s functions will not work, that should be stated, and why, as we may know how to make it work. -- HTH RP (remove nothere from the email address if mailing direct) "TedMi" wrote in message ... Please answer the question: IS IT POSSIBLE TO USE VBA FUNCTIONS IN A WORKSHEET. Everyone has focused on the use of the DateAdd function, but there are hundreds of other VBA functions that are not supported by worksheet functions. Jim Thomlinson came the closest - create a user-defined function. But then, what magic incantations do I have to invoke to use it in a cell formula? Thanks. -- Ted "Jeff" wrote: Is it possible to use VBA functions in a worksheet? I'd like to use the Dateadd() function on a worksheet. Jeff |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
worksheet functions | Excel Worksheet Functions | |||
Using VBA Functions in a worksheet | Excel Programming | |||
Worksheet functions | New Users to Excel | |||
worksheet functions | Excel Worksheet Functions | |||
Public Functions As Worksheet Available Functions | Excel Programming |