To add a custom function to a Module in the Personal Macro Workbook (To learn more about creating a Personal Macro Workbook.
1. Press Alt+F11 to open the VBE.
2. Double-click a Module name in the Personal Macro Workbook, or insert a new Module into the Personal Macro Workbook by selecting Module from the Insert menu.
3. Enter the following code lines into the Module:
Function QuarterNum(Enter_Date)
QuarterNum = DatePart ("q", Enter_Date)
End Function
To test the Custom Function:
1. Select any empty cell and press Shift+F3 to open the Paste Function dialog box.
2. In the User Defined category, select QuarterNum, and then click OK.
3. In the Function Arguments dialog box, enter the address of a cell containing a date, and click OK.
Screenshot // Adding a Custom Function That Returns the Quarter Number
Terms
and Conditions of use
The applications/code on this site are distributed as is and without warranties
or liability. In no event shall the owner of the copyrights, or the authors
of the applications/code be liable for any loss of profit, any problems
or any damage resulting from the use or evaluation of the applications/code.