|
Tech Tip of the Week
Adding a custom function that returns the quarter number
To
add a custom function to a module in the Personal Macro Workbook or to learn
more about creating a Personal Macro Workbook you need to do the following.
Press Alt+F11 to open the VBE then 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. Now enter the following code lines into the module
Function QuarterNum (Enter Date) QuarterNum = DatePart (q, Enter_Date)End
Function
Then to test the custom function, select any empty cell and press Shift+F3 to
open the paste function dialog box. Later, in the user defined category, select
QuarterNum, and then click OK. Finally, in the Function Arguments dialog box,
enter the address of a cell containing a date, and click OK.
|