Re Sylvie
je ne pense pas que l'endroit ou se trouve la macro soit le problème
j'ai mis la Macro qui suit dans un Module n°1 chez moi Lol
et celà fonctionne
pour ce qui est de L'Option explicit cette Option impose la déclaration des Variables aurais tu ajouter quelques variables que tu n'aurais pas déclarées ????
voici la Macro à mettre dans ton module et à coller au bouton
Sub tri()
Dim tabtemp As Variant
Dim tmp As Variant, tmp2 As Variant
Dim Ws As Worksheet
Dim x As Byte, L As Byte, L2 As Byte
x = 1
ReDim tabtemp(2, x)
For Each Ws In Worksheets
If Right(Ws.Name, 3) = 'xls' Then
ReDim Preserve tabtemp(2, x)
tabtemp(1, x) = Ws.Name
tabtemp(2, x) = Ws.Range('C2').Value
x = x + 1
End If
Next
For L = 1 To UBound(tabtemp, 2)
For L2 = L + 1 To UBound(tabtemp, 2)
If tabtemp(2, L2) < tabtemp(2, L) Then
tmp = tabtemp(2, L2): tmp2 = tabtemp(1, L2)
tabtemp(2, L2) = tabtemp(2, L): tabtemp(1, L2) = tabtemp(1, L)
tabtemp(2, L) = tmp: tabtemp(1, L) = tmp2
End If
Next
Next
L = 1
Application.ScreenUpdating = False
For Each Ws In Worksheets
If Right(Ws.Name, 3) <> 'xls' Then
Ws.Select
Else
For L = 1 To UBound(tabtemp, 2)
Sheets(tabtemp(1, L)).Move after:=ActiveSheet
Sheets(tabtemp(1, L)).Select
Next
End If
Next
Sheets('Feuil1').Select
Application.ScreenUpdating = True
End Sub
tiens moi au courant
Message édité par: Chti160, à: 05/07/2005 10:54