Extraire un vecteur d'une matrice
par
, 14/07/2015 à 10h23 (327 Affichages)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 'Fonction qui récupere un vecteur Function ExtraireVecteur(ByVal Matrice As Variant, Ligne As Long, OneColonne As Boolean) As Variant 'defintion variables Dim i As Long, j As Long Dim VaR As Variant 'extraction If OneColonne = False Then ReDim VaR(UBound(Matrice, 2)) End If For i = 1 To UBound(Matrice, 1) If i = Ligne Then If OneColonne = False Then For j = 1 To UBound(Matrice, 2) VaR(j) = Matrice(i, j) Next ExtraireVecteur = VaR Exit Function Else ExtraireVecteur = Matrice(i) Exit Function End If End If Next i 'vidage Erase VaR End Function