Copier coller somme de deux colonnes

Bonjour à tous !

J'ai une vieille macro que je souhaiterai compléter pour la mettre en relation avec une autre macro. Est-il possible d'avoir simplement la somme de la colonne E et F (à partir de la ligne 2 jusqu'à la fin). et de coller la somme dans la colonne L (toujours à partir de la ligne 2).

Je souhaiterais mettre cette macro au bout de la macro suivante :

Sub MacroBFCC()

Columns("A:H").Select

ActiveWorkbook.Worksheets("operations").Sort.SortFields.Clear

ActiveWorkbook.Worksheets("operations").Sort.SortFields.Add Key:=Range( _

"E2:E1002"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _

xlSortNormal

ActiveWorkbook.Worksheets("operations").Sort.SortFields.Add Key:=Range( _

"B2:B1002"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _

xlSortNormal

With ActiveWorkbook.Worksheets("operations").Sort

.SetRange Range("A1:H1002")

.Header = xlYes

.MatchCase = False

.Orientation = xlTopToBottom

.SortMethod = xlPinYin

.Apply

End With

Range("H2").Select

ActiveCell.FormulaR1C1 = "=LEFT(RC[-5],5)"

Range("H2").Select

Selection.Copy

Range("H3:H1002").Select

Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _

SkipBlanks:=False, Transpose:=False

Range("H2").Select

Range(Selection, Selection.End(xlDown)).Select

Application.CutCopyMode = False

Selection.Copy

ActiveWindow.SmallScroll Down:=-84

ActiveWindow.ScrollRow = 872

ActiveWindow.ScrollRow = 851

ActiveWindow.ScrollRow = 828

ActiveWindow.ScrollRow = 793

ActiveWindow.ScrollRow = 749

ActiveWindow.ScrollRow = 680

ActiveWindow.ScrollRow = 617

ActiveWindow.ScrollRow = 524

ActiveWindow.ScrollRow = 430

ActiveWindow.ScrollRow = 349

ActiveWindow.ScrollRow = 242

ActiveWindow.ScrollRow = 171

ActiveWindow.ScrollRow = 114

ActiveWindow.ScrollRow = 64

ActiveWindow.ScrollRow = 23

ActiveWindow.ScrollRow = 1

Range("I2").Select

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _

:=False, Transpose:=False

Selection.Replace What:="06", Replacement:="C6", LookAt:=xlPart, _

SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False

Selection.Replace What:="07", Replacement:="C7", LookAt:=xlPart, _

SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False

Selection.Replace What:="51000", Replacement:="", LookAt:=xlPart, _

SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False

Selection.Replace What:="99999", Replacement:="C", LookAt:=xlPart, _

SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False

Range("K17").Select

Application.CutCopyMode = False

ActiveCell.FormulaR1C1 = "-1"

Range("K17").Select

Selection.Copy

Columns("E:E").Select

Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _

SkipBlanks:=False, Transpose:=False

Merci d'avance pour votre aide

Bonjour Liod,

Outch, ça pique les yeux

Comme nous n'avons pas de fichier, c'est un peu au jugé

Sub MacroBFCC()
  Dim dLig As Long
  With ActiveWorkbook.Worksheets("operations")
    With .Sort
      With .SortFields
        .Clear
        .Add Key:=Range("E2:E1002"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
        .Add Key:=Range("B2:B1002"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
      End With
      .SetRange Range("A1:H1002")
      .Header = xlYes
      .MatchCase = False
      .Orientation = xlTopToBottom
      .SortMethod = xlPinYin
      .Apply
    End With
    dLig = .Range("H" & Rows.Count).End(xlUp).Row
    .Range("H2:H" & dLig).FormulaLocal = "=GAUCHE(C2;5)"
    .Range("H2:H" & dLig).Copy
    .Range("I2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    With .Columns("I:I")
      .Replace What:="06", Replacement:="C6", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
        SearchFormat:=False, ReplaceFormat:=False
      .Replace What:="07", Replacement:="C7", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
        SearchFormat:=False, ReplaceFormat:=False
      .Replace What:="51000", Replacement:="", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
        SearchFormat:=False, ReplaceFormat:=False
      .Replace What:="99999", Replacement:="C", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
        SearchFormat:=False, ReplaceFormat:=False
    End With
    ' Là, je ne comprens pas pourquoi K17 !?
    .Range("K17").Value = -1
    .Range("K17").Copy
    .Columns("E2:E" & dLig).PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, SkipBlanks:=False, Transpose:=False
    ' Somme des 2 colonnes E et F dans la colonne L
    .Range("L2:L" & dLig).FormulaLocal = "=E2+F2"
  End With
End Sub

@+

Merci beaucoup ta macro fonctionne très bien je l'ai réadapter un peu mais c'était carrément l'idée :)

Rechercher des sujets similaires à "copier coller somme deux colonnes"