Using Excel 2019
I want to create a function that one on the arguments is one cell below one of the selection, I have no idea how to do that.
I Want a function that that multiply A and B , AND offset of one row below the selection of cell of B
My attempt:
Function MYFUNCTION(Num_1 As Integer, Num_2 As Integer) As Integer
Dim Num_3 As Integer
Num_3 = Range("Num_2").Offset(1, 0).Value
MYFUNCTION = Num_1 * Num_2 * Num_3
End Function
Seems like the code is compiling successfully, but function returns #VALUE!.
Obviously... Not working.
Other then few videos on how to create you "own" A*B function , there is nothing in terms of videos on creating advance function with VBA (To clarify , I'm not talking about subroutines)
Use
Rangeparameters, notIntegers:The
Application.Volatileis (unfortunately) necessary to recalculate the formula whenNum2.Offset(1)'s value changes.It's likely not a good idea to use
Integerhere. I'd suggestDouble, or at leastLong.It's likely a good idea to just use three parameters to begin with.