Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
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 :
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
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
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" <al@wanadoo.fr> a écrit dans le message de
news:edqRIbLgKHA.2184@TK2MSFTNGP04.phx.gbl...
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 ?
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 :