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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
| Option Explicit
Option Base 1
Dim f1 As Worksheet, f2 As Worksheet, FeuilleActive As String
Sub archiveRow(myRow As Long)
' **************************************************************************************
' Author : Christian CROCHE
' Date : 31/07/2019
' Description : Ajouter un "x" ou "X" dans la colonne M lance une copie de la ligne
' dans la feuille Tâches réalisées et supprime la ligne de la feuille Travail
' **************************************************************************************
Dim myVariable As String, modeDebug As Boolean
Dim NwLig As Long
modeDebug = False
If Not modeDebug Then
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
End If
' Comment
If modeDebug Then Stop
Set f1 = Sheets("Tâches réalisées")
Set f2 = Sheets("Rétro planning")
f2.Range("A" & myRow & ":F" & myRow).Copy
NwLig = f1.Range("B" & Rows.Count).End(xlUp).Row + 1
f1.Range("A" & NwLig).PasteSpecial (xlPasteFormulasAndNumberFormats)
f1.Cells(NwLig, 1) = Date
f2.Application.EnableEvents = False
f2.Range("A" & myRow & ":M" & myRow).Delete Shift:=xlShiftUp
Application.EnableEvents = True
'Application d'un quadrillage
FeuilleActive = "Tâches réalisées"
Quadrillage
FeuilleActive = "Rétro planning"
Quadrillage
If Not modeDebug Then
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End If
Set f1 = Nothing
Set f2 = Nothing
End Sub
Sub recoverRow(myRow As Long)
' **************************************************************************************
' Author : Christian CROCHE
' Date : 01/08/2019
' Description : Ajouter un "x" ou "X" dans la colonne M lance une copie de la ligne
' dans la feuille Travail et supprime la ligne de la feuille Archive
' **************************************************************************************
Dim myVariable As String, modeDebug As Boolean
modeDebug = False
If Not modeDebug Then
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
End If
' Comment
If modeDebug Then Stop
Set f1 = Sheets("Tâches réalisées")
Set f2 = Sheets("Rétro planning")
f1.Range("B" & myRow & ":F" & myRow).Copy
f2.Range("B100000").End(xlUp).Offset(1, 0).PasteSpecial (xlPasteFormulasAndNumberFormats)
Application.EnableEvents = False
f1.Cells(myRow, 1).EntireRow.Delete Shift:=xlShiftUp
Application.EnableEvents = True
' Tri personnalisé
f2.Select
Range("A4:F" & Range("B" & Rows.Count).End(xlUp).Row).Sort [B4], 1
'Application d'un quadrillage
FeuilleActive = "Rétro planning"
Quadrillage
FeuilleActive = "Tâches réalisées"
Quadrillage
If Not modeDebug Then
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End If
Set f1 = Nothing
Set f2 = Nothing
End Sub
Sub Quadrillage()
Dim DerLig As Long, DerCol As Long
Application.ScreenUpdating = False
Sheets(FeuilleActive).Select
DerLig = Sheets(FeuilleActive).Range("B4").End(xlDown).Row
If FeuilleActive = "Tâches réalisées" Then
DerCol = 7
If [C5] = "" Then DerLig = 4
ElseIf FeuilleActive = "Rétro planning" Then
DerCol = 6
If [C4] = "" Then DerLig = 3
End If
Cells.Borders().LineStyle = xlNone
Range(Cells(2, "A"), Cells(DerLig, DerCol)).Borders().Weight = xlThin
Range(Cells(1, "A"), Cells(1, DerCol)).Borders().Weight = xlMedium
If FeuilleActive = "Tâches réalisées" Then
Range("A2:G4").Borders().Weight = xlMedium
ElseIf FeuilleActive = "Rétro planning" Then
Range("A2:F3").Borders().Weight = xlMedium
End If
End Sub |
Partager