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
| Sub rempl_IMS(arg) 'Remplissage automatique de l'onglet IMS de la semaine en cours + mise en forme conditionnelle des cellules
Dim kR As Long, kC As Integer
Application.ScreenUpdating = False
With Worksheets("IMS_CW" & num_sem & "_" & annee)
If arg <> "" Then
Set rech_nom = Nothing
Set rech_nom = .Range("A:A").Find(what:=nom_toolmoov & " " & pre_toolmoov, lookat:=xlWhole, MatchCase:=False)
kR = rech_nom.Row
Set rech_date = Nothing
Set rech_date = .Range("13:13").Find(what:=aujourdhui, lookat:=xlWhole, MatchCase:=False)
kC = rech_date.Column
.Unprotect "admin"
If .Cells(kR, kC) <> "" Then
If .Cells(kR, kC + 3) <> "" Then 'les deux champs remplis on recommence
.Cells(kR, kC).Resize(1, 5) = "" 'on efface les 5 colonnes successives
Else
kC = kC + 3
End If
End If
If .Cells(kR, kC) <> "MAJ" Then
'.Cells(kR, kC) = arg
'.Cells(kR, kC) = arg & vbLf & Format(Time, "hh:mm")
.Cells(kR, kC) = arg & vbLf & Format(Now, "dd/mm/yy hh\hnn")
End If
If arg = "MAJ" Then
.Cells(kR, kC + 1) = ecart & " Kg " & vbLf & commentaire
Else
.Cells(kR, kC + 1) = ecart & " Kg"
End If
End If
Autoremplissage kC, Worksheets("IMS_CW" & num_sem & "_" & annee)
.Protect Password:="admin", DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFiltering:=True
End With
ThisWorkbook.Save
Application.ScreenUpdating = True
End Sub |
Partager