Re : Garder la formule "DECALER"
Re
pendant que j'y étais, j'ai un peu modifié
la macro traite les vendus et les invendus en même temps, par contre la cellule B8 ne doit pas être vide mais elle n'est plus utilisée pour spécifier vendu invendu
A+
Sub Imprim_Vente()
Dim Tabtemp As Variant
Dim L As Byte
Dim C As Byte
Dim Derlgn As Integer
Dim Cell As Range
Dim Ws_1 As Worksheet
Dim Date_Transfert As String
Dim Libelle_Transfert As String
Dim Test As Boolean
Set Ws_1 = Worksheets("RécapVente")
Application.ScreenUpdating = False
With Worksheets("Vente")
Date_Transfert = Format(.Range("B7"), " dddd dd mmmm yyyy")
Libelle_Transfert = "Vendu"
Tabtemp = .Range(.Cells(9, 2), .Cells(.Cells(8, 2).End(xlDown).Row, .Cells(8, 2).End(xlToRight).Column)).Value
If Tabtemp(LBound(Tabtemp, 1), 1) = "" Then Exit Sub
.Range(.Cells(9, 3), .Cells(.Cells(8, 2).Row + (((.Cells(9, 2).End(xlDown).Row - .Cells(8, 2).Row) - 2) / 2), .Cells(8, 2).End(xlToRight).Column)).ClearContents
.Range(.Cells(.Cells(9, 3).Row + ((.Cells(9, 2).End(xlDown).Row - .Cells(8, 2).Row) / 2), 3), .Cells(.Cells(9, 2).End(xlDown).Row - 1, .Cells(8, 2).End(xlToRight).Column)).ClearContents
End With
With Ws_1
For L = 1 To UBound(Tabtemp, 1)
If Not Left(Tabtemp(L, 1), 5) = "TOTAL" Then
Test = False
For C = 2 To UBound(Tabtemp, 2)
If Not (Tabtemp(L, C) = "") Then Test = True
Next
If Test = True Then
Derlgn = .Range("A65536").End(xlUp).Row + 1
.Cells(Derlgn, 1) = Date_Transfert
.Cells(Derlgn, 3) = Libelle_Transfert
For C = 1 To UBound(Tabtemp, 2)
If C = 1 Then
.Cells(Derlgn, 1 + C) = Tabtemp(L, C)
Else
.Cells(Derlgn, 2 + C) = Tabtemp(L, C)
End If
Next
End If
Else
Libelle_Transfert = "Invendu"
End If
Next
End With
Tabtemp = ""
Application.ScreenUpdating = True
End Sub