If I've understood correctly I think I can do this as a one liner:
Function distance(rng1 As Range, rng2 As Range)
distance = Evaluate("SQRT(SUM((" & rng1.Address _
& "-" & rng2.Address & ")^2))")
End Function
(the middle line there has a vba continuation line in and should paste
across without editing)
This gives the same result as the formula in the spreadsheet
array-entered thus:
=SQRT(SUM((D5:F7-K14:M16)^2))
(Array-entered means holding the Ctrl and Shft keys while pressing the
Enter key to commit the formula.)
Which in turn gives the same result as doing it long hand.
At the moment, there are no checks to see that both ranges are the
same size. Use the function in a worksheet like so:
=distance(D5:F7,K14:M16)