Tutorial by Examples

Open Excel Open the Visual Basic Editor ( see Opening the Visual Basic Editor ) Add a new module by clicking Insert --> Module : Copy and Paste the following code in the new module : Public Function Hello() As String 'Note: the output of the function is simply the function's name ...
It's easier to implement some UDFs on the worksheet if full column references can be passed in as parameters. However, due to the explicit nature of coding, any loop involving these ranges may be processing hundreds of thousands of cells that are completely empty. This reduces your VBA project (and ...
Function countUnique(r As range) As Long 'Application.Volatile False ' optional Set r = Intersect(r, r.Worksheet.UsedRange) ' optional if you pass entire rows or columns to the function Dim c As New Collection, v On Error Resume Next ' to ignore the Run-time error 457: "Th...

Page 1 of 1