Bonjour Baton,
Désolé j'avais zappé ton post
Toujours un peu difficile lorsqu'on a pas MAC. Effectivement, la ligne qui fait défaut est spécifique à Microsoft.
Réessaie en remplaçant la macro Consolide par celle-ci :
Sub consolide()
Dim WbkMaitre As Workbook, WbkConso As Workbook
Dim nbLign As Long, derLign&, doublon&, i&, j&, k&, cpt&, derLignC&, derLignA&
Dim TblCde, temp
Dim repertoire As String
Dim cel As Range, trouve As Range
Application.ScreenUpdating = False
'classeur maître : Fichier contenant le bon de commande
Set WbkMaitre = ThisWorkbook
repertoire = WbkMaitre.Path & "\" 'mettre le chemin du répertoire contenant les BD ici, laisser le "\" à la fin
'If Left(CurDir, 1) <> Left(repertoire, 1) Then ChDrive Left(repertoire, 1) & ":": ChDir repertoire
'classeur cible 1 : Fichier de commandes consolidées
Workbooks.Open repertoire & "BD consolidées Model .xls"
Set WbkConso = ActiveWorkbook
With WbkMaitre.Sheets("Commande")
'compte le nombre de ligne de commande
nbLign = .Application.WorksheetFunction.Count(.Range("C:C"))
'si le nombre de ligne est nul on sort de la macro
If nbLign = 0 Then MsgBox "La commande ne comporte aucune ligne": Exit Sub
Set TblCde = .[C3].Resize(nbLign, 24)
End With
With WbkConso
.Activate
With .Sheets("Data")
derLign = .Range("C" & Rows.Count).End(xlUp).Row + 1
.Range("C" & derLign).Resize(nbLign, 24).Value = TblCde.Value
TblCde.Copy
.Range("C" & derLign).PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
'suppression des doublons
For Each cel In .Range("C" & derLign).Resize(nbLign)
doublon = Evaluate("SumProduct((" & .Range("C3:C" & derLign - 1).Address & "=" & cel.Value & ")*(" & .Range("D3:D" & derLign - 1).Address & "=" & cel.Offset(, 1).Value & "))")
If doublon > 0 Then Cells(cel.Row, 1).Value = "$$$"
Next cel
Set trouve = .Range("A" & derLign).Resize(nbLign).Find("$$$", LookAt:=xlWhole)
If Not trouve Is Nothing Then
For i = nbLign + derLign - 1 To derLign Step -1
If .Cells(i, 1) = "$$$" Then .Rows(i).Delete
Next i
End If
derLignC = .Range("C" & Rows.Count).End(xlUp).Row
derLignA = IIf(.Range("A" & Rows.Count).End(xlUp).Row + 1 < 3, 3, .Range("A" & Rows.Count).End(xlUp).Row + 1)
If derLignC > derLignA Then
For i = derLignA To derLignC
.Cells(i, 1) = .Cells(i - 1, 1) + 1
Next i
End If
End With
'.Close
End With
With WbkMaitre
.Activate
a = .Sheets("Commande").Range("c3").Resize(nbLign).Value
lim = UBound(a)
ReDim temp(1 To lim, 1 To 1)
k = 1
cpt = 0
temp(1, 1) = a(1, 1)
For i = 1 To lim
For j = 1 To lim
If a(i, 1) = temp(j, 1) Then Exit For
cpt = cpt + 1
Next j
If cpt = lim Then k = k + 1: temp(k, 1) = a(i, 1)
cpt = 0
Next i
For i = 1 To k
Call Cde_Equip(WbkMaitre, .Sheets("Commande"), repertoire, temp(i, 1))
Next i
End With
End Sub
N'oublie pas d'adapter le répertoire.