Created
October 24, 2023 20:55
-
-
Save machkouroke/6e621f27d69b8344b63979803069a1e4 to your computer and use it in GitHub Desktop.
Diagonale function in excel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Option Base 1 | |
Function Diag(matrix() As Variant) As Variant | |
Dim i As Integer, n As Integer | |
Dim D() As Variant | |
n = UBound(matrix, 1) | |
ReDim D(n, 1) | |
For i = 1 To n | |
D(i, 1) = matrix(i, i) | |
Next i | |
Diag = D | |
End Function | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment