Results 1 to 1 of 1
2005-06-20, 13:26 #1
- Join Date
- Feb 2004
- Cape Town, RSA
- Thanked 1 Time in 1 Post
Days in Month Function (Excel 2000>)
I have been dabbling in the add-ins feature and topping up my knowledge regarding it. I particularly like add-ins for functions, for when you use them in the WB, the formula bar does not give the FilePath and Function name like: PERSONAL.XLS!DaysInMonth... Also, you do not need to rely on the Personal.xls file, and have to ensure the function is in that file.
Here is a function that can be installed using the Add-In's feature. (Click on the browse button in the Add-in's dialog, and browse for the add-in at location: Documents and Settings/<user name>/Application Data/Microsoft/AddIns folder. You will need to have copied the add-in to this location first!) Once activated it will supply the user with a function that will work out the amount of days within a given month! To use the function, select the Date Category in the Paste Function Dialog Box.
The code for the UDF looks like this:
<pre>Function DaysInMonth(Supply_Date As Date) As Integer
DaysInMonth = Day(DateSerial(Year(Supply_Date), Month(Supply_Date) + 1, 0))
If you don't want to use the add-in, then just copy the Function macro into the workbook (Preferably the Personal Macro Workbook!) to use it...
I have tested all of it and it works well on my side. But the Excel guru's can please chip in with any advice or improvements.
ALSO: I notice that Excel2002 has a property in VBA called IsAddIn. I found that you do not need to have a copy of an add-in as an xls file and an xla version. In the past you needed to change the xls and resave as xla to over-write. No all you need to do is change the property IsAddIn from TRUE to FALSE, and this toggles the visibility and options...(Very convenient)Regards,