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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
| Sub verrouiller()
On Error GoTo 1:
ActiveSheet.ShowAllData
1:
Range("L:L,O:O").Select
Selection.Copy
Columns("IU:IU").Select
ActiveSheet.Paste
Columns("IU:IU").Replace What:=".", Replacement:=".", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Range("L1").Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,C[243])"
Range("K1").Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection = "Sous Total"
Columns("IV:IV").Replace What:=".", Replacement:=".", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Range("O1").Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,C[241])"
Range("N1").Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection = "Sous Total"
Cells.Select
Selection.AutoFilter
If ActiveSheet.AutoFilterMode Then
Else
Selection.AutoFilter
End If
Selection.AutoFilter Field:=15, Criteria1:="<>"
Rows("1:1").Select
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
Columns("B:B").Select
Selection.Locked = False
Selection.FormulaHidden = False
Range("B1").Select
ActiveSheet.Protect Password:="PASSWORD", DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFiltering:=True
ActiveSheet.EnableSelection = xlUnlockedCells
MsgBox "Le fichier 'outgoing invoice' est Vérouillé", vbInformation, "Confirmation"
End Sub
Sub dévérouiller()
ActiveSheet.Unprotect Password:="PASSWORD"
On Error GoTo fin:
ActiveSheet.ShowAllData
fin:
Rows("65536:65536").Select
Selection.ClearContents
Columns("IU:IV").Select
Selection.ClearContents
Rows("1:1").Select
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
Columns("B:B").Select
Selection.Locked = True
Selection.FormulaHidden = False
Range("B1").Select
ActiveCell.FormulaR1C1 = "INVOICE_NR"
MsgBox "Le fichier 'outgoing invoice' est Dévérouillé", vbInformation, "Confirmation"
End Sub |
Partager