Answer
Putting the function in the “ThisWorkbook” area can cause the #NAME?
problem. Create a new Module (Right Click on the VBAProject Folder, Insert, New Module)
and put the function there instead.
Steps
- Open the VBA Editor (
Alt + F11
on Windows /Fn + Option + F11
on a Mac) - Right-click VBAProject
- Select Insert >> Module
-
Create a
Public
function insideModule1
, for example:Public Function findArea(ByVal width as Double, _ ByVal height as Double) As Double ' Return the area findArea = width * height End Function
-
Call it from a cell, like any other function:
=findArea(B12,C12)