NatKJ
XLDnaute Nouveau
Bonjour le Forum,
Etant une bille sur VBA, je cherche une solution au problème suivant:
J'aimerais intégrer dans ce code une ligne qui dit : à la fin de la dernière ligner collée il apparait une nouvelle ligne qui commence dans la colonne ("A") avec l'intitulé "Total" et dans la colonne ("F") "La somme"
Si quelqu'un a une piste, je suis preneuse
Nat,
Etant une bille sur VBA, je cherche une solution au problème suivant:
J'aimerais intégrer dans ce code une ligne qui dit : à la fin de la dernière ligner collée il apparait une nouvelle ligne qui commence dans la colonne ("A") avec l'intitulé "Total" et dans la colonne ("F") "La somme"
VB:
Private Sub CommandButton3_Click()
Dim c As Range
Dim rng As Range
Dim last As Long
Dim soustotal As Double
soustotal = 0
last = Application.WorksheetFunction.Max(31, Sheets("PROPOSAL").Cells(Rows.Count, "A").End(xlUp).Row) + 1
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Set rng = Range("D9:D100")
For Each c In rng
If (Sheets("List Bank").Range("C" & c.Row).Value <> 0) Then
Sheets("PROPOSAL").Range("A" & last).Value = Sheets("List Bank").Range("C" & c.Row).Value
If (Sheets("List Bank").Range("D" & c.Row).Value <> 0) Then
Sheets("PROPOSAL").Range("D" & last).Value = Sheets("List Bank").Range("D" & c.Row).Value
Sheets("PROPOSAL").Range("E" & last).Value = "1"
End If
last = last + 1
End If
Next c
Sheets("PROPOSAL").Range("A" & last).Value = "Sub Total Transport"
Sheets("PROPOSAL").Range("F" & last).Value = soustotal
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
MsgBox " All Copies have been performed ... "
End Sub
Si quelqu'un a une piste, je suis preneuse
Nat,