Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Tri dans un tableau en mémoire (rediffusion)

1 réponse
Avatar
Al
Bonjour à tous,

j'ai stocké un tableau de valeurs (TabVal(2000) as double).
je voudrais les trier par ordre croissant

Y a t il une fonction dans Visual Basic ?
Comment faire ?

Merci pour votre aide
Al

1 réponse

Avatar
Philippe.R
Bonjour,
Regarde la réponse apportée par Frédéric Sigonneau (FS) dans la ficelle
initiale :
'_______________________________________________________________
Bonjour,

Rien de tout fait mais de nombreuses fonctions VBA existent.
Par exemple :

'============================ Sub ShellSort(DataArray())
'Myrna Larson, mpep
Dim ArrayValue As String
Dim Min As Long, Max As Long
Dim N As Long, h As Long
Dim i As Long, j As Long, p As Long

Min = LBound(DataArray)
Max = UBound(DataArray)
N = Max - Min + 1
h = 1
Do
h = h * 3 + 1
Loop While h <= N

Do
h = h 3
For i = Min + h To Max
ArrayValue = DataArray(i)
For j = i - h To Min Step -h
If DataArray(j) > ArrayValue Then
DataArray(j + h) = DataArray(j)
Else
Exit For
End If
Next j
DataArray(j + h) = ArrayValue
Next i
Loop While h > 1

End Sub 'ShellSort
'============================
D'autres solutions possibles ici :

http://frederic.sigonneau.free.fr/Tris.htm" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://frederic.sigonneau.free.fr/Tris.htm

FS
--
Frédéric SIGONNEAU
Modules et modèles pour Excel :
http://frederic.sigonneau.free.fr/
'__________________________________________________________
--
Avec plaisir
http://dj.joss.free.fr/trombine.htm
http://jacxl.free.fr/mpfe/trombino.html
Philippe.R
Pour se connecter au forum :
http://www.excelabo.net/web/mpfe
News://news.microsoft.com/microsoft.public.fr.excel
"Al" a écrit dans le message de
news:
Bonjour à tous,

j'ai stocké un tableau de valeurs (TabVal(2000) as double).
je voudrais les trier par ordre croissant

Y a t il une fonction dans Visual Basic ?
Comment faire ?

Merci pour votre aide
Al