Function xlMSUB(M1, M2)
Dim rslt()
Dim i, j
Dim rws1,
rws2, cls1, cls2
rws1 =
M1.Rows.Count
cls1 =
M1.Columns.Count
rws2 =
M2.Rows.Count
cls2 =
M2.Columns.Count
ReDim
rslt(1 To rws1, 1 To cls1)
If (rws1
<> rws2) Or (cls1 <> cls2) Then
xlMSUB
= "xlERR1"
Else
For i
= 1 To rws1
For j = 1 To cls1
rslt(i, j) = M1(i, j) - M2(i, j)
Next j
Next i
xlMSUB
= rslt
End If
End Function
|
Friday, August 19, 2016
xlMatrix series: Subtracting 2 matrixes
Report any errors to afstblogs@gmail.com
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.