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 56 57 58 59 60 61 62 63
| Private Sub CommandButton1_Click()
On Error GoTo errLigne
Dim Colonne As String, Formule As String, i As Long, Cel As String
ActiveSheet.Unprotect Password:=""
Select Case Range("AA2")
Case "Janvier"
Colonne = "T"
Case "Fevrier"
Colonne = "U"
Case "Mars"
Colonne = "V"
Case "Avril"
Colonne = "W"
Case "Mai"
Colonne = "X"
Case "Juin"
Colonne = "Y"
Case "Juillet"
Colonne = "Z"
Case "Septembre"
Colonne = "P"
Case "Octobre"
Colonne = "Q"
Case "Novembre"
Colonne = "R"
Case "Decembre"
Colonne = "S"
End Select
For i = 11 To 15
' modification formule sur collone G
Formule = "=(O" & i & "*" & Colonne & i & ")"
Cel = "G" & i
Worksheets("Le Taillan-Médoc Lot 15").Range(Cel) = Formule
' modification formule sur collone I
Formule = "=((M" & i & "*E" & i & ")/177)*" & Colonne & i
Cel = "I" & i
Worksheets("Le Taillan-Médoc Lot 15").Range(Cel) = Formule
' modification formule sur collone J
Formule = "=(F" & i & "/177)*" & Colonne & i
'(F12/177)*P12
Cel = "J" & i
Worksheets("Le Taillan-Médoc Lot 15").Range(Cel) = Formule
' modification formule sur collone K
'((C12*H12)*P12)*M12
Formule = "=((C" & i & "*H" & i & ")*" & Colonne & i & ")*M" & i
Cel = "K" & i
Worksheets("Le Taillan-Médoc Lot 15").Range(Cel) = Formule
Next
ActiveSheet.Protect Password:=""
Exit Sub
errLigne:
MsgBox Err.Number & vbLf & Err.Description
End Sub |
Partager