Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA User Defined Function not working in Mac Excel 2016

I wrote a user-defined function in Excel 2016 for Mac. The function itself works; I called it within VBA in a new Subroutine and it worked fine. But when I call it from the sheet, it does nothing.

    Function isMultipleOf5(myInput As Integer) As Boolean

    Dim result As Double

    result = myInput Mod 5

    If result = 0 Then
        isMultipleOf5 = True
    Else
        isMultipleOf5 = False
    End If

    End Function
like image 261
Nate Avatar asked Nov 02 '25 00:11

Nate


1 Answers

It turns out I was placing the code under "Microsoft Excel Objects", and putting the code in ThisWorkbook or Sheet1 doesn't allow the function to work. Instead, you must right-click on Microsoft Excel Objects -> Insert -> Module -> place the code in the new blank area.

like image 98
Nate Avatar answered Nov 03 '25 13:11

Nate