PDA

View Full Version : function with paramarray help



plazmatv
05-25-2018, 12:23 PM
Hello everybody!
So i cannot figure out how to make this function work.
It has to have 2 arguments
The first one is boolean and the second one is paramarray.
It has to calculate the average of the numbers in the paramarray range.
When the boolean is true , it has to control if the cells in the paramarray range contain numbers (is numeric) , and if not write an error.
When the boolean is false it should ignore what format is in the cells in the paramarray range and just calculate the average of the numbers.

I need this for school test so any little help helps.
Thanks to everyone.

Paul_Hossler
05-25-2018, 01:50 PM
We don't do homework, but will answer questions and offer hint

Here's a skeleton function almost right out of the online Help




Option Explicit


Function Demo(B As Boolean, ParamArray A()) As Variant


Dim i As Long

For i = LBound(A) To UBound(A)

'do stuff


Next i



End Function