Sub mouvements_de_stock()
[COLOR="Green"]' Macro raccourci par Excel-lent[/COLOR]
Application.ScreenUpdating = False
[COLOR="Green"]'suppression des colonnes inutiles et formatage des colonnes[/COLOR]
Range("D:D,H:J,L:AA").Delete
Columns("D:D").Cut
Columns("H:H").Insert
Columns("D:E").NumberFormat = "0_ ;[Red]-0 "
Range("F:F,H:I").NumberFormat = "m/d/yyyy h:mm"
[COLOR="Green"]'création colonne date d'entrée, date de sortie, dépôt, technicien[/COLOR]
[H1] = "Date entrée"
[I1] = "Date sortie"
[J1] = "Dépôt"
[K1] = "Technicien"
Dim e
e = [A65536].End(xlUp).Row
For i = 1 To e
Application.DisplayAlerts = False
Range("H2:H" & e) = "=IF(RC[-4]=0,"""",RC[-2])" [COLOR="Green"]'Date d'entrée[/COLOR]
Range("I2:I" & e) = "=IF(RC[-4]=0,"""",RC[-3])" [COLOR="Green"]'Date de sortie[/COLOR]
Range("J2:J" & e) = "=LEFT(RC[-3],4)" [COLOR="Green"]'Dépôt[/COLOR]
Range("K2:K" & e) = "=TRIM(RC[-1])" [COLOR="Green"]'Technicien[/COLOR]
Application.DisplayAlerts = True
Next i
[COLOR="Green"]'mise en page[/COLOR]
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cells.Select
Application.CutCopyMode = False
With Selection.Font
.Name = "Arial"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
End With
Range("D:G,J:J").Delete
With Rows("1:1")
.Font.Bold = True
For x = 5 To 12
Selection.Borders(x).LineStyle = xlNone
Next x
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
Columns("F:F").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
Columns("A:B").ColumnWidth = 13.57
Columns("C:C").ColumnWidth = 42.14
Columns("D:E").ColumnWidth = 16.43
Columns("F:F").ColumnWidth = 10.71
[A1].Select
End Sub