Wednesday, May 30, 2012

Excel Shortcut: Add Date or Time to Cell

To quickly add current date to active cell press CTRL + SEMICOLON (i.e. CTRL + ; )

To add current time press CTRL + COLON (i.e. CTRL + : )

Monday, May 28, 2012

VBA: Remove All Shapes From Sheet

To remove all shapes from a sheet, use the below snippet:

Sub RemoveShapes()


    Dim s As Shape


    For Each s In ActiveSheet.Shapes
        s.Delete
    Next s


End Sub

Friday, May 11, 2012

Excel: Count Unique (Number) Values

To count the unique number values in a range, say for example column A, you can use a combination of SUM, IF and FREQUENCY formulas.

Example:
=SUM(IF(FREQUENCY(A:A;A:A)>0;1))


Check the help for more details on FREQUENCY formula.