XL 2016 Ajout de ligne (VBA)

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"

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,
 

Membres actuellement en ligne

Aucun membre en ligne actuellement.

Statistiques des forums

Discussions
312 086
Messages
2 085 197
Membres
102 814
dernier inscrit
JLGalley