User FAQs


1) How can I use one of these functions in my workbook ?
To be able to use one of these user defined functions you will need to add it to the VBA Project that is associated with that workbook.
The following page describes how to do this.


2) Write a User Defined Function to return the day of the week ?

Public Function DAY_OF_WEEK1() As String 
   DAY_OF_WEEK1 = Application.WorksheetFunction.TEXT( _
                   Application.WorksheetFunction.NOW,"dddd")
End Function

Public Function DAY_OF_WEEK2() As String
   DAY_OF_WEEK2 = VBA.FORMAT(VBA.NOW,"dddd")
End Function

3) Write a User Defined Function that accepts two arguments and returns the lowest common denominator ?

Public Function LOWEST_COMMON_DENOM(ByVal Number1 As Double, _ 
                                    ByVal Number2 As Double) As Double
   LOWEST_COMMON_DENOM = Application.WorksheetFunction.LCM(Number1, Number2)
End Function

4) What is Application.Volatile ?

Application.Volatile 

This line of code can be included in your user defined functions to force them to recalculate every time a value changes on that particular worksheet.
Volatile functions will always recalculate.



© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext