je réalise une ptite macro qui permet de trier les lignes d'une feuille mais qund je lance la macro à partir d'une autre , excel me dit qu'ile me manque une variable, ou aussi qu'il attend un "=" derrière le nom de la macro : voici la macro en question:
Sub subZonage(zone As String, nblignesvisite As Integer, nomfeuille As String)
Dim indiceligne As Integer
indiceligne = 0
For i = 1 To nblignesvisite 'BOUCLE DE COPIE DES ITEMS
If Worksheets(nomfeuille).Cells(i, 9).Value = zone Then
Worksheets(nomfeuille).Rows(1).Insert Shift:=xlDown 'insertion de ligne
MsgBox ("blung:" & Worksheets(nomfeuille).Cells(i + 1, 9).Value & " ligne: " & i)
Worksheets(nomfeuille).Rows(i + 1).Select
Selection.Cut Destination:=Worksheets(nomfeuille).Rows(1)
indiceligne = indiceligne + 1
i = i + 1
End If
Next i
For d = nblignesvisite To 1 Step -1
If Application.CountA(Rows(d)) = Empty Then Rows(d).Delete
Next d
MsgBox ("blung:" & indiceligne)
Range("A1:Q" & indiceligne).Select
'selectionne toutes les lignes remplies
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
Selection.Rows.Group
End Sub
et quand je la lance comme montré plus bas, excel bloque sur la ligne subzonage:
Sub zonage(nomfeuille As String)
Dim nblignesvisite As Integer
Dim i As Integer
Dim indiceligne As Integer