vincent115
XLDnaute Nouveau
Bonjour
J'ai un tableau où je désire trier les noms cela marche bien, mais c'est quand je veux les réunir dans une colonne que cela bug.
Code :
Sub Tri_aléatoire()
'
' Tri_aléatoire Macro
' Macro enregistrée le 07/07/2013 par Bibi
'
' Touche de raccourci du clavier: Ctrl+Maj+V
' Tri aleatoire
For i = 8 To 97
If Range("J" & i) <> "" Then Range("K" & i) = Rnd
Next i
Range("J8:K97").Sort Key1:=Range("K8"), Order1:=xlAscending, Header:=xlNo
Range("K8:K97").ClearContents
For i = 8 To 97
If Range("D" & i) <> "" Then Range("E" & i) = Rnd
Next i
Range("D8:E97").Sort Key1:=Range("E8"), Order1:=xlAscending, Header:=xlNo
Range("E8:E97").ClearContents
For i = 8 To 97
If Range("G" & i) <> "" Then Range("H" & i) = Rnd
Next i
Range("G8:H97").Sort Key1:=Range("H8"), Order1:=xlAscending, Header:=xlNo
Range("H8:H97").ClearContents
'Copie des colonnes de tri dans colonne Tirage
Sheets("Inscriptions").Range(Range("d8"), Range("d8").End(xlDown)).Copy Destination:=Sheets("Inscriptions").Range("c8")
Sheets("Inscriptions").Range(Range("j8"), Range("j8").End(xlDown)).Copy Destination:=Sheets("Inscriptions").Range("c65536").End(xIUp)(2)
Sheets("Inscriptions").Range(Range("g8"), Range("g8").End(xlDown)).Copy Destination:=Sheets("Inscriptions").Range("c65536").End(xIUp)(2)
End Sub
Quelqu'un peut-il me signaler l'erreur de code ? J'ai cherché dans les différents posts sans succès.
J'ai un tableau où je désire trier les noms cela marche bien, mais c'est quand je veux les réunir dans une colonne que cela bug.
Code :
Sub Tri_aléatoire()
'
' Tri_aléatoire Macro
' Macro enregistrée le 07/07/2013 par Bibi
'
' Touche de raccourci du clavier: Ctrl+Maj+V
' Tri aleatoire
For i = 8 To 97
If Range("J" & i) <> "" Then Range("K" & i) = Rnd
Next i
Range("J8:K97").Sort Key1:=Range("K8"), Order1:=xlAscending, Header:=xlNo
Range("K8:K97").ClearContents
For i = 8 To 97
If Range("D" & i) <> "" Then Range("E" & i) = Rnd
Next i
Range("D8:E97").Sort Key1:=Range("E8"), Order1:=xlAscending, Header:=xlNo
Range("E8:E97").ClearContents
For i = 8 To 97
If Range("G" & i) <> "" Then Range("H" & i) = Rnd
Next i
Range("G8:H97").Sort Key1:=Range("H8"), Order1:=xlAscending, Header:=xlNo
Range("H8:H97").ClearContents
'Copie des colonnes de tri dans colonne Tirage
Sheets("Inscriptions").Range(Range("d8"), Range("d8").End(xlDown)).Copy Destination:=Sheets("Inscriptions").Range("c8")
Sheets("Inscriptions").Range(Range("j8"), Range("j8").End(xlDown)).Copy Destination:=Sheets("Inscriptions").Range("c65536").End(xIUp)(2)
Sheets("Inscriptions").Range(Range("g8"), Range("g8").End(xlDown)).Copy Destination:=Sheets("Inscriptions").Range("c65536").End(xIUp)(2)
End Sub
Quelqu'un peut-il me signaler l'erreur de code ? J'ai cherché dans les différents posts sans succès.