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
| Sub CréerSituation()
Columns(2).Find("*", , , , , xlPrevious).Offset(-1, 0).Select
Selection.EntireRow.Insert Shift:=xlDown
NumAdhérent = InputBox("SAISIR LE N° D' ADHÉRENT")
If NumAdhérent = "" Then Exit Sub
ActiveCell.Offset(0, -1) = NumAdhérent
TypeSituation = InputBox("SAISIR LE TYPE DE SITUATION :" & vbLf & "(1-2-3-4-5-6)")
If TypeSituation = "" Then Exit Sub
DateSituation = InputBox("SAISIR LA DATE DE SITUATION ")
If DateSituation = "" Then Exit Sub
ActiveCell.Offset(0, 1) = DateSituation
If Right(ActiveCell.Offset(-1, 0), 2) = "DO" Then
ActiveCell.FormulaR1C1 = "=""N° "" & TypeSituation & UserName ()& ""/""&TEXT(RC[1],""aamm"")&TEXT(RIGHT(R[-2]C,3)+1, ""000"")"
Else
ActiveCell.FormulaR1C1 = "=""N° "" & TypeSituation & UserName () & ""/""&TEXT(RC[1],""aamm"")&TEXT(RIGHT(R[-1]C,3)+1,""000"")"
End If
End Sub
Public Function UserName()
UserName = Mid(Application.UserName, 1, 1) & Mid(Application.UserName, 4, 1)
End Function |
Partager