Public
Function
Berechne(
ByVal
Matrix
As
Range,
ByVal
Startp
As
Range,
ByVal
Endp
As
Range)
Dim
K()
As
Variant
Dim
s
As
Variant
, e
As
Variant
s = Startp.Value: e = Endp.Value
K = Koord(Matrix, s, e)
Berechne = distance(K(0, 0), K(0, 1), K(1, 0), K(1, 1))
End
Function
Private
Function
Koord(
ByVal
Matrix
As
Range,
ByVal
Startp
As
Variant
,
ByVal
Endp
As
Variant
)
As
Variant
Dim
arrK(1, 1)
As
Variant
arrK(0, 0) = WorksheetFunction.VLookup(Startp, Matrix, 2,
True
)
arrK(0, 1) = WorksheetFunction.VLookup(Startp, Matrix, 3,
True
)
arrK(1, 0) = WorksheetFunction.VLookup(Endp, Matrix, 2,
True
)
arrK(1, 1) = WorksheetFunction.VLookup(Endp, Matrix, 3,
True
)
Koord = arrK
End
Function
Private
Function
distance(
ByVal
yA
As
Double
,
ByVal
xA
As
Double
,
ByVal
yB
As
Double
,
ByVal
xB
As
Double
)
distance = Sqr((yA - yB) ^ 2 + (xA - xB) ^ 2)
End
Function