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
| Private Sub CommandButton4_Click()
Application.Calculation = xlCalculationManual
Range("A30").Select
nblignes = Range("A30", Selection.End(xlDown)).Cells.Count
q = 29 + nblignes
derncol = Range("A30").End(xlToRight).Column
dercol = derncol + 2
avdercol = derncol + 1
dcol = Split(Columns(dercol).Address(ColumnAbsolute:=False), ":")(1)
avcol = Split(Columns(avdercol).Address(ColumnAbsolute:=False), ":")(1)
col = Split(Columns(derncol).Address(ColumnAbsolute:=False), ":")(1)
Columns(avcol & ":" & dcol).Insert Shift:=xlToRight
celltxt = Range(col & "30").Value
cellval = Right(celltxt, 1) + 1
Range(avcol & "30") = "Versement VS - " & cellval
Range(avcol & "31:" & avcol & q).NumberFormat = "#,##0.00 "
Range(dcol & "30") = "Date versement VS - " & cellval
Range(dcol & "31:" & dcol & q).NumberFormat = "dd/mm/yy"
Range(avcol & "30:" & dcol & "30").HorizontalAlignment = xlCenter
Range(avcol & "30:" & dcol & "30").VerticalAlignment = xlVAlignCenter
Range(avcol & "30:" & dcol & "30").Font.ColorIndex = 1
Range(avcol & "30:" & dcol & "30").WrapText = True
derncola = Range("A30").End(xlToRight).Column
dcola = Split(Columns(derncola).Address(ColumnAbsolute:=False), ":")(1)
Columns("W:" & dcola).ColumnWidth = 17
Range("W30:" & dcola & "30").Borders.LineStyle = 1
f = 31
Do While f <= q
val1 = Range("V" & f).FormulaLocal
val1 = Replace(val1, ";2)", "")
Range("V" & f).FormulaLocal = val1 & "-" & avcol & f & ";2)"
f = f + 1
Loop
formul1 = Range("H16").Formula
formul2 = Len(formul1)
formul2 = formul2 - 1
formul3 = Left(formul1, formul2)
Range("H16").Formula = formul3 & "," & avcol & "31:" & avcol & q & ")"
Application.Calculation = xlCalculationAutomatic
ActiveSheet.Calculate
End Sub |
Partager