1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Option Explicit
Sub GRAND_LIVRE()
Dim plage As Range, cel As Range, plage1 As Range, plage2 As Range
Dim valcherch As String, derlig As Long, derlig2 As Long
Application.ScreenUpdating = False
valcherch = Sheets("EDITION").Range("B5") ' ici pour moi c'est le nom de la banque
'suppression ancoen données
With Worksheets("EDITION")
derlig = .Range("A" & Rows.Count).End(xlUp).Row
Set plage1 = .Range("A12:A" & derlig)
If .Range("A12") <> "" Then
plage1.EntireRow.Delete
End If
End With
'insertion nv données
With Worksheets("Mouvement")
derlig = .Range("A" & Rows.Count).End(xlUp).Row
Set plage = .Range("A11:A" & derlig)
derlig2 = .Range("B" & Rows.Count).End(xlUp).Row
Set plage2 = .Range("B11:A" & derlig2)
End With
For Each cel In plage
If cel = valcherch And Sheets("EDITION").Range("B6") <= cel(, 2) And cel(, 2) <= Sheets("EDITION").Range("B7") Then
Worksheets("EDITION").Cells(Rows.Count, 1).End(xlUp)(2) = cel(, 2)
Worksheets("EDITION").Cells(Rows.Count, 1).End(xlUp)(1, 2) = cel(, 5)
Worksheets("EDITION").Cells(Rows.Count, 1).End(xlUp)(1, 3) = cel(, 7)
Worksheets("EDITION").Cells(Rows.Count, 1).End(xlUp)(1, 4) = cel(, 8)
End If
Next cel
Application.ScreenUpdating = True
End Sub |
Partager