bonsoir a vous tous
donc comme je ne comprends rien , je vais faire comme ucfoutu préconise, mais depuis j'ai fait évoluer mon fichier
donc dans le code qui suit(si je le place bien?) Sub ChangementPage(NoLigne As Long)
With Sheets("facturation")
[Modèle!A1:P13].Copy
.Cells(NoLigne, 1).Insert Shift:=xlDown
.HPageBreaks.Add before:=.Cells(NoLigne, 1)
.Cells(NoLigne + 8, "L").FormulaR1C1 = "=R[-11]C"
.Cells(NoLigne + 8, "O").FormulaR1C1 = "=R[-11]C"
.Cells(NoLigne + 8, "P").FormulaR1C1 = "=R[-11]C"
.Cells(NoLigne + 11, "L").FormulaR1C1 = "=SUM(R[-2]C:R[-1]C)"
.Cells(NoLigne + 11, "O").FormulaR1C1 = "=SUM(R[-2]C:R[-1]C)"
.Cells(NoLigne + 11, "P").FormulaR1C1 = "=SUM(R[-2]C:R[-1]C)"
.Range(.Cells(NoLigne + 8, "C"), .Cells(NoLigne + 8, "I")).Font.Size = 16
.Range(.Cells(NoLigne + 8, "C"), .Cells(NoLigne + 8, "I")).Font.Bold = True
.Cells(NoLigne + 8, "C").HorizontalAlignment = xlRight
.Cells(NoLigne + 8, "I").HorizontalAlignment = xlLeft
End With
End Sub
de code fonctionne très bien, mais ne mets pas de bordures sous("CàM et OàP")lors de copie de cette partie
.Cells(NoLigne + 7, "C") = .[C17]
.Cells(NoLigne + 7, "I") = .[I17]
ce code est activer par le bouton ajout d'articles sur la feuille, ce bouton a pour code
Private Sub CommandButton2_Click()
Dim lig As Integer, CtrMt As Double, CtrTVA7 As Double, CtrTVA19 As Double
With Sheets("facturation")
lig = .Range("B65536").End(xlUp).Row
If (lig - 56) Mod 80 = 0 Then
ChangementPage lig + 4
lig = lig + 14
ElseIf [B19] = "" Then
lig = 19
Else
lig = .Range("B65536").End(xlUp)(2).Row
End If
.Rows(lig + 1).Insert
'<.Cells(lig, "C").Borders(xlEdgeLeft).LineStyle xlContinuous
.Range(.Cells(lig, "I"), .Cells(lig, "P")).Borders(xlEdgeLeft).LineStyle = xlContinuous
.Range(.Cells(lig, "C"), .Cells(lig, "M")).Borders(xlEdgeTop).LineStyle = xlNone
.Range(.Cells(lig, "O"), .Cells(lig, "P")).Borders(xlEdgeTop).LineStyle = xlNone
.Range(.Cells(lig, "C"), .Cells(lig, "M")).Borders(xlEdgeBottom).LineStyle = xlContinuous
.Range(.Cells(lig, "O"), .Cells(lig, "P")).Borders(xlEdgeBottom).LineStyle = xlContinuous
.Range(.Cells(lig, "D"), .Cells(lig, "H")).Borders(xlInsideVertical).LineStyle = xlNone
.Range(.Cells(lig, "I"), .Cells(lig, "Q")).Borders(xlInsideVertical).LineStyle = xlContinuous
.Range(.Cells(lig, "O"), .Cells(lig, "P")).VerticalAlignment = xlCenter
.Range(.Cells(lig, "I"), .Cells(lig, "M")).VerticalAlignment = xlCenter
.Range("c19:M19,O19:P19").Borders(xlEdgeTop).LineStyle = xlContinuous
'<=================================================================================================
DoEvents '***AOT
.Range("B" & lig).Value = Txtnumero.Value
.Range("K" & lig).Value = Txt_vente.Value
.Range("M" & lig).NumberFormat = "###0"
If Me.OptionButton1 = True Then
.Range("M" & lig).Value = 1
Else
.Range("M" & lig).Value = 2
End If
'.Range("M" & lig).Value = Abs(Me.OptionButton2.Value) + 1
.Range(.Cells(lig, "B"), .Cells(lig, "P")).HorizontalAlignment = xlCenter
.Cells(lig, "C").HorizontalAlignment = xlLeft
.Range(.Cells(lig, "B"), .Cells(lig, "P")).Font.Name = "Arial"
.Range(.Cells(lig, "C"), .Cells(lig, "P")).Font.Size = 12
.Cells(lig, "B").Font.Size = 9
.Cells(lig, "O").FormulaR1C1 = "=IF(RC[-2]=1,RC[-6]*RC[-4]*0.07,"""")"
.Cells(lig, "P").FormulaR1C1 = "=IF(RC[-3]=2,RC[-7]*RC[-5]*0.196,"""")"
.Cells(lig, "B") = Me.Txtnumero
.Cells(lig, "C") = Me.txtArticle
.Cells(lig, "I") = Me.txtPU
.Cells(lig, "J") = Me.txtUnité
.Cells(lig, "K") = Me.Txt_vente
If IsNumeric(.Cells(lig, "I")) And IsNumeric(.Cells(lig, "K")) Then
.Cells(lig, "L") = CDbl(.Cells(lig, "I")) * CDbl(.Cells(lig, "K"))
Else
.Cells(lig, "O") = ""
.Cells(lig, "P") = ""
End If
'.Range("B19:M" & lig + 1).Sort Key1:=.Range("B19"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
For i = lig To 1 Step -1
If .Cells(i, "K") <> "REPORT" And .Cells(i, "K") <> "Quantité" Then
If IsNumeric(.Cells(i, "L")) Then CtrMt = CtrMt + .Cells(i, "L")
If IsNumeric(.Cells(i, "O")) Then CtrTVA7 = CtrTVA7 + .Cells(i, "O")
If IsNumeric(.Cells(i, "P")) Then CtrTVA19 = CtrTVA19 + .Cells(i, "P")
Else
If IsNumeric(.Cells(i, "L")) Then CtrMt = CtrMt + .Cells(i, "L")
If IsNumeric(.Cells(i, "O")) Then CtrTVA7 = CtrTVA7 + .Cells(i, "O")
If IsNumeric(.Cells(i, "P")) Then CtrTVA19 = CtrTVA19 + .Cells(i, "P")
Exit For
End If
Next i
.Cells(lig + 1, "L") = CtrMt
.Cells(lig + 1, "O") = CtrTVA7
.Cells(lig + 1, "P") = CtrTVA19
'Txtnumero.Value = ""
'txtArticle.Value = ""
'txtPU.Value = ""
'Txt_vente.Value = ""
'Txt_qté_stock_article.Value = ""
'Txtrestant.Value = ""
'txtUnité.Value = ""
End With
End Sub
qui permet le saut de page par la détection du nombre de ligne inscrite par cette partie
If (lig - 56) Mod 80 = 0 Then
ChangementPage lig + 4
lig = lig + 14
voila ce qu'il arrive a ce fichier qui n'est pas le même que j'ai voulu joindre auparavant
cordialement
Pascal