My questions is somewhat related to this post.
However, let's say I want to use Excel's built-in MOD
(modulo) function in VBA.
This site suggests that using Application.WorksheetFunction.[insert name of Excel function]
would provide the desired effect.
However, Application.WorksheetFunction.MOD
does not work.
In fact, when I simply type Application.WorksheetFunction.
into VBA, a dropdown menu appears providing a list of function names to choose from, but MOD
is not provided in this list!
2 questions:
- What's going on here?
- How do I actually use Excel's built-in
MOD
function in VBA?
Note: I started down this path b/c I'm trying to get 1.7 Mod 0.5
to equal 0.2
using VBA's Mod
function, but it produces #VALUE!
in the resulting Excel cell I apply my VBA function to. However, if I type MOD(1.7,0.5)
directly into Excel, I get the correct answer (i.e., 0.2
)