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
|
Public Sub ReverseWorkDirectionType0(ByRef shTable() As Excel.Worksheet)
Application.screenUpdating = False
Application.EnableEvents = False
UF_ProgressBar.Display text1:=IIf(shTable(4).Range("F7") = PROJECTWORKDIRECTION.Increasing, c_increasingConvert, c_decreasingConvert)
Dim ob(1 To 6) As Excel.OptionButton
Dim table() As REVERSEDATA
Dim i%, j%, k%, lastLine%
ReDim table(shTable(4).Range("F23") - 1)
lastLine = shTable(4).Range("F24")
' Verouille les options buttons
For i = LBound(ob) To UBound(ob)
Set ob(i) = shTable(0).OptionButtons("Option Button " & i)
ob(i).Enabled = False
Next i
UF_ProgressBar.SetValueMax shTable(4).Range("F23") * 6 ' (x6 car on lit 2x par feuille de travail (x3 feuilles de travail))
UF_ProgressBar.SetTextLabel2 "0 %"
SheetsUnprotect
Rem Boucle les 3 feuilles de travail
For j = 1 To 3
Rem Lecture des données
k = -1
For i = c_firstLineProject To lastLine
Incr k
With shTable(j)
table(k).km = -.Cells(i, 2) ' Km (Double car jamais vide)
table(k).cumul = .Cells(i, 3) ' Cumul
table(k).rep = .Cells(i, 5) ' Repère
table(k).repTextColor = .Cells(i, 5).Font.Color ' Couleur texte repère
table(k).haRef = .Cells(i, 6) ' Hauteur : référence
table(k).haAv = .Cells(i, 7) ' Hauteur : avant bourrage
table(k).haAp = .Cells(i, 10) ' Hauteur : après bourrage
table(k).diRef = IIf(IsNum(.Cells(i, 12)), -.Cells(i, 12), "") ' Distance : référence
table(k).diAv = IIf(IsNum(.Cells(i, 13)), -.Cells(i, 13), "") ' Distance : avant bourrage
table(k).diAp = IIf(IsNum(.Cells(i, 17)), -.Cells(i, 17), "") ' Distance : après bourrage
table(k).deRef = IIf(IsNum(.Cells(i, 22)), -.Cells(i, 22), "") ' Dévers : référence
table(k).deAv = IIf(IsNum(.Cells(i, 25)), -.Cells(i, 25), "") ' Dévers : avant bourrage
table(k).deAp = IIf(IsNum(.Cells(i, 31)), -.Cells(i, 31), "") ' Dévers : après bourrage
End With ' table(j)
UF_ProgressBar.SetValue
Next i
Rem Écriture des données et recalcul des feuilles
For i = c_firstLineProject To lastLine
With shTable(j)
.Cells(i, 2) = table(k).km ' Km
.Cells(i, 3) = IIf(IsNum(table(k).cumul), CDbl(table(k).cumul), "") 'CDbl(table(k).cumul) ' Cumul
.Cells(i, 5) = table(k).rep ' Repère
.Cells(i, 5).Font.Color = table(k).repTextColor ' Couleur texte repère
Rem Hauteur
.Cells(i, 6) = table(k).haRef ' Référence
.Cells(i, 7) = table(k).haAv ' Avant bourrage
.Cells(i, 10) = table(k).haAp ' Après bourrage
HeightCalculate .Cells(i, 8), .Cells(i, 7), .Cells(i, 6) ' Correction 0
HeightCalculate .Cells(i, 9), .Cells(i, 7), .Cells(i, 6), .Range("I7") ' Correction ??
HeightCalculate .Cells(i, 11), .Cells(i, 10), .Cells(i, 6) ' Résultat
Rem Distance
.Cells(i, 12) = table(k).diRef ' Référence
.Cells(i, 13) = table(k).diAv ' Avant bourrage
.Cells(i, 17) = table(k).diAp ' Après bourrage
DistanceCalculate .Cells(i, 15), .Cells(i, 13), .Cells(i, 12) ' Correction
DistanceCalculate .Cells(i, 19), .Cells(i, 17), .Cells(i, 12) ' Résultat
Rem Dévers
.Cells(i, 22) = table(k).deRef ' Référence
.Cells(i, 25) = table(k).deAv ' Avant bourrage
.Cells(i, 31) = table(k).deAp ' Après bourrage
CantCalculate .Cells(i, 28), .Cells(i, 25), .Cells(i, 22) ' Correction
CantCalculate .Cells(i, 34), .Cells(i, 31), .Cells(i, 22) ' Résultat
CantArrows .Cells(i, 22)
CantArrows .Cells(i, 25)
CantArrows .Cells(i, 31)
End With ' table(j)
Incr k, -1
UF_ProgressBar.SetValue
Next i
Next j
Rem Si on est pas en mode admin, on verouille les feuilles
If shTable(4).Range("F1") <> 1 Then _
SheetsProtect
' Déverouille les options buttons
For i = LBound(ob) To UBound(ob)
ob(i).Enabled = True
Set ob(i) = Nothing
Next i
Erase table
Unload UF_ProgressBar
Application.EnableEvents = True
Application.screenUpdating = True
End Sub |