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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| Sub recap()
Dim test As Range
Dim save() As String
Dim last_cell As Range
Dim off As Integer
With Worksheets("Base")
Set test = .Range("A1")
Set last_cell = .Columns(1).Find("*", , , , xlByColumns, xlPrevious)
ActiveCell.Offset(1, 1) = "RECAPITULATION GENERALE"
ActiveCell.Offset(1, 1).HorizontalAlignment = xlCenter
ActiveCell.Offset(1, 1).VerticalAlignment = xlCenter
ActiveCell.Offset(1, 1).Font.Underline = True
ActiveCell.Offset(1, 1).Font.Bold = True
off = 0
For i = 0 To last_cell.Row
If Len(test.Offset(i, 0).Value) = 3 Then
For j = 0 To 5
ActiveCell.Offset(3 + off, j) = test.Offset(i, j)
Next j
off = off + 1
End If
Next i
Set last_cell = .Columns(1).Find("*", , , , xlByColumns, xlPrevious)
last_cell.Offset(2, 3) = "Montant Total HT"
last_cell.Offset(2, 3).Font.Bold = True
last_cell.Offset(2, 3).HorizontalAlignment = xlCenter
last_cell.Offset(2, 3).VerticalAlignment = xlCenter
last_cell.Offset(2, 4) = "="
last_cell.Offset(2, 4).HorizontalAlignment = xlCenter
last_cell.Offset(2, 4).VerticalAlignment = xlCenter
last_cell.Offset(3, 3) = "Montant TVA 19,60 %"
last_cell.Offset(3, 3).Font.Bold = True
last_cell.Offset(3, 3).HorizontalAlignment = xlCenter
last_cell.Offset(3, 3).VerticalAlignment = xlCenter
last_cell.Offset(3, 4) = "="
last_cell.Offset(3, 4).HorizontalAlignment = xlCenter
last_cell.Offset(3, 4).VerticalAlignment = xlCenter
last_cell.Offset(4, 3) = "Montant Total TTC"
last_cell.Offset(4, 3).Font.Bold = True
last_cell.Offset(4, 3).HorizontalAlignment = xlCenter
last_cell.Offset(4, 3).VerticalAlignment = xlCenter
last_cell.Offset(4, 4) = "="
last_cell.Offset(4, 4).HorizontalAlignment = xlCenter
last_cell.Offset(4, 4).VerticalAlignment = xlCenter
End With
End Sub |
Partager