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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477
| 'APPELE DES DONNEE'
Private Sub ComEQUI_Change()
Dim Ligne As Integer
With ThisWorkbook.Sheets("Donnée équipement")
Ligne = .Columns("B").Find(Me.ComEQUI.Value, .Range("b2"), xlValues).Row
Me.TextMISE.Value = .Cells(Ligne, "J") 'colone j'
Me.TextDUREVIE.Value = .Cells(Ligne, "L") 'colone L'
Me.TextREMPL.Value = .Cells(Ligne, "M") 'colone M'
Me.TextDURVIERESI.Value = .Cells(Ligne, "N") 'colone N'
Me.TextESTIMREMPL.Value = .Cells(Ligne, "O") 'colone O'
Me.Textlocal.Value = .Cells(Ligne, "E") 'colone E'
Me.Textfamequi.Value = .Cells(Ligne, "C") 'colone C'
Me.Textcodequi.Value = .Cells(Ligne, "A") 'colone A'
Me.Textlibelocal.Value = .Cells(Ligne, "F") 'colone F'
End With
End Sub
'enregistrement et protection blocage des donnees'
Private Sub CommandButton1_Click()
Dim l_info As Integer
Dim note_1 As String, note_2 As String, lanote As String
Dim ws As Worksheet
'protection feuille
Dim cell As Range
Dim pl As Range
Worksheets("TABLEAU RECAP").Visible = True
Worksheets("TABLEAU RECAP").Unprotect ("cedric")
Sheets("TABLEAU RECAP").Cells.Locked = True
For Each cell In Sheets("TABLEAU RECAP").Range("M2")
If cell.MergeCells = True Then
Set pl = cell.MergeArea
cell.UnMerge
cell.Locked = False
pl.Merge
Else
cell.Locked = False
End If
Next cell
Worksheets("TABLEAU RECAP").Protect ("cedric"), DrawingObjects:=True, Contents:=True, Scenarios:=True, UserInterfaceOnly:=True
With ThisWorkbook.Worksheets("TABLEAU RECAP")
l_info = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Range("B" & l_info).Value = ComEQUI 'libelle equipement'
.Range("c" & l_info).Value = Textlocal 'code local"
.Range("D" & l_info).Value = ComRESP 'Nom du responsable'
.Range("E" & l_info).Value = CDate(TextDATEAM) 'date du constat'
.Range("F" & l_info).Value = CDate(TextMISE) 'date de mise en service'
.Range("G" & l_info).Value = CInt(TextDUREVIE.Value) 'Duree de vie theorique'
.Range("H" & l_info).Value = CDate(TextREMPL) 'Date theorique de remplacement '
.Range("I" & l_info).Value = CInt(TextDURVIERESI.Value) 'Duree de vie residuelle '
.Range("J" & l_info).Value = TextESTIMREMPL 'Duree de vie residuelle '
.Range("K" & l_info).Value = CInt(TextRESUETAT.Value) 'note de etat equipement'
.Range("l" & l_info).Value = CInt(TextRESUCRIT.Value) 'note de criticite equipement'
If CheckBox1.Value Then
'cas case cochee
.Range("p" & l_info).Value = "x"
.Range("q" & l_info).Value = CDate(Textboxdatechange) 'date de remplacement équipement
MsgBox ("attention imformer au equipe gmao le changement de l'equipement")
Else
'cas case non cochee
'rien ?
End If
If UserFormpri.CheckBox1.Value = True Then
UserForm2.TextBox6.Value = Me.ComEQUI.Value 'colle valeur équipement dans le texbox de l'uesrform2 et l'appeler
UserForm2.Show
Else
'rien
End If
With .Range("M" & l_info)
'formulation
.FormulaR1C1 = "=IF(RC[-2]<=21,""Mauvais"",IF(RC[-2]<=43,""Usuel"",IF(RC[-2]<=64,""Bon"")))"
'équivaut à un collage spécial valeur
.Value = .Value
note_1 = .Value
End With
With .Range("N" & l_info)
'formulation
.FormulaR1C1 = "=IF(RC[-2]<=21,""Faible"",IF(RC[-2]<=43,""Moyenne"",IF(RC[-2]<=64,""Forte"")))"
'équivaut à un collage spécial valeur
.Value = .Value
note_2 = .Value
End With
Select Case True
Case note_1 = "Mauvais" And note_2 = "Faible"
lanote = "B"
Case note_1 = "Mauvais" And note_2 = "Moyenne"
lanote = "C"
Case note_1 = "Mauvais" And note_2 = "Forte"
lanote = "C"
Case note_1 = "Usuel" And note_2 = "Faible"
lanote = "A"
Case note_1 = "Usuel" And note_2 = "Moyenne"
lanote = "B"
Case note_1 = "Usuel" And note_2 = "Forte"
lanote = "B"
Case note_1 = "Bon" And note_2 = "Faible"
lanote = "A"
Case note_1 = "Bon" And note_2 = "Moyenne"
lanote = "A"
Case note_1 = "Bon" And note_2 = "Forte"
lanote = "A"
End Select
.Range("O" & l_info).Value = lanote 'donne de la note dans le tableau recap
'si mon chexbox est cocher et que la note est superieur a l'annee d'avant message et fermeture de userform et sans validation dans le tableau recap
Set ws = ThisWorkbook.Worksheets("TABLEAU RECAP")
l_info = ws.Cells.Find(ComEQUI.Value, , , xlWhole).Row
If ws.Range("O" & l_info).Value > lanote And CheckBox1.Value = False Then
If MsgBox("Note différente de l'année dernière", vbOK Or vbCancel) = vbOK Or vbCancel Then
Sheets("TABLEAU RECAP").Range("b" & Sheets("TABLEAU RECAP").Range("b65000").End(xlUp).Row).EntireRow.ClearContents
MsgBox ("Recommencer l'evaluation")
End If
Set ws = ThisWorkbook.Worksheets("Donnée équipement")
l_info = ws.Cells.Find(ComEQUI.Value, , , xlWhole).Row 'si la note est inferieur a la donne de G "donne equipement" et chexbox pas coché rien faire
If ws.Range("G" & l_info).Value < lanote And CheckBox1.Value = False Then
End If
Set ws = ThisWorkbook.Worksheets("Donnée équipement")
l_info = ws.Cells.Find(ComEQUI.Value, , , xlWhole).Row 'si la note est superieur a la donne dans G "donnée equipement" et chexbx coché
If ws.Range("G" & l_info).Value < lanote And CheckBox1.Value = True Then
ws.Range("G" & l_info).Value = lanote
End If
End If
End With
Me.hide
Unload UserFormpri
End Sub
Private Sub Label2_Click()
End Sub
'saisie des options'
Private Sub OptionButton1_Change()
Dim i As Integer
i = 0
Do Until Frame2.Controls(i).Value
i = i + 1
Loop
Frame2.Controls("textbox1").Value = i + 1
End Sub
Private Sub OptionButton2_Change()
Dim i As Integer
i = 0
Do Until Frame2.Controls(i).Value
i = i + 1
Loop
Frame2.Controls("textbox1").Value = i + 1
End Sub
Private Sub OptionButton3_Change()
Dim i As Integer
i = 0
Do Until Frame2.Controls(i).Value
i = i + 1
Loop
Frame2.Controls("textbox1").Value = i + 1
End Sub
Private Sub OptionButton4_Change()
Dim i As Integer
i = 0
Do Until Frame2.Controls(i).Value
i = i + 1
Loop
Frame2.Controls("textbox1").Value = i + 1
End Sub
Private Sub OptionButton5_Change()
Dim i As Integer
i = 0
Do Until Frame3.Controls(i).Value
i = i + 1
Loop
Frame3.Controls("textbox2").Value = i + 1
End Sub
Private Sub OptionButton6_Change()
Dim i As Integer
i = 0
Do Until Frame3.Controls(i).Value
i = i + 1
Loop
Frame3.Controls("textbox2").Value = i + 1
End Sub
Private Sub OptionButton7_Change()
Dim i As Integer
i = 0
Do Until Frame3.Controls(i).Value
i = i + 1
Loop
Frame3.Controls("textbox2").Value = i + 1
End Sub
Private Sub OptionButton8_Change()
Dim i As Integer
i = 0
Do Until Frame3.Controls(i).Value
i = i + 1
Loop
Frame3.Controls("textbox2").Value = i + 1
End Sub
Private Sub OptionButton9_Change()
Dim i As Integer
i = 0
Do Until Frame4.Controls(i).Value
i = i + 1
Loop
Frame4.Controls("textbox3").Value = i + 1
End Sub
Private Sub OptionButton10_Change()
Dim i As Integer
i = 0
Do Until Frame4.Controls(i).Value
i = i + 1
Loop
Frame4.Controls("textbox3").Value = i + 1
End Sub
Private Sub OptionButton11_Change()
Dim i As Integer
i = 0
Do Until Frame4.Controls(i).Value
i = i + 1
Loop
Frame4.Controls("textbox3").Value = i + 1
End Sub
Private Sub OptionButton12_Change()
Dim i As Integer
i = 0
Do Until Frame4.Controls(i).Value
i = i + 1
Loop
Frame4.Controls("textbox3").Value = i + 1
End Sub
Private Sub OptionButton13_Change()
Dim i As Integer
i = 0
Do Until Frame6.Controls(i).Value
i = i + 1
Loop
Frame6.Controls("textbox4").Value = i + 1
End Sub
Private Sub OptionButton14_Change()
Dim i As Integer
i = 0
Do Until Frame6.Controls(i).Value
i = i + 1
Loop
Frame6.Controls("textbox4").Value = i + 1
End Sub
Private Sub OptionButton15_Change()
Dim i As Integer
i = 0
Do Until Frame6.Controls(i).Value
i = i + 1
Loop
Frame6.Controls("textbox4").Value = i + 1
End Sub
Private Sub OptionButton16_Change()
Dim i As Integer
i = 0
Do Until Frame6.Controls(i).Value
i = i + 1
Loop
Frame6.Controls("textbox4").Value = i + 1
End Sub
Private Sub OptionButton17_Change()
Dim i As Integer
i = 0
Do Until Frame7.Controls(i).Value
i = i + 1
Loop
Frame7.Controls("textbox5").Value = i + 1
End Sub
Private Sub OptionButton18_Change()
Dim i As Integer
i = 0
Do Until Frame7.Controls(i).Value
i = i + 1
Loop
Frame7.Controls("textbox5").Value = i + 1
End Sub
Private Sub OptionButton19_Change()
Dim i As Integer
i = 0
Do Until Frame7.Controls(i).Value
i = i + 1
Loop
Frame7.Controls("textbox5").Value = i + 1
End Sub
Private Sub OptionButton20_Change()
Dim i As Integer
i = 0
Do Until Frame7.Controls(i).Value
i = i + 1
Loop
Frame7.Controls("textbox5").Value = i + 1
End Sub
Private Sub OptionButton21_Change()
Dim i As Integer
i = 0
Do Until Frame8.Controls(i).Value
i = i + 1
Loop
Frame8.Controls("textbox6").Value = i + 1
End Sub
Private Sub OptionButton22_Change()
Dim i As Integer
i = 0
Do Until Frame8.Controls(i).Value
i = i + 1
Loop
Frame8.Controls("textbox6").Value = i + 1
End Sub
Private Sub OptionButton23_Change()
Dim i As Integer
i = 0
Do Until Frame8.Controls(i).Value
i = i + 1
Loop
Frame8.Controls("textbox6").Value = i + 1
End Sub
Private Sub OptionButton24_Change()
Dim i As Integer
i = 0
Do Until Frame8.Controls(i).Value
i = i + 1
Loop
Frame8.Controls("textbox6").Value = i + 1
End Sub
'calcule des notes'
Private Sub CommandButton2_Click()
TextRESUETAT = (CDbl(TextBox1.Value) * CDbl(TextBox2.Value) * CDbl(TextBox3.Value))
TextRESUCRIT = (CDbl(TextBox4.Value) * CDbl(TextBox5.Value) * CDbl(TextBox6.Value))
End Sub
'format date de l'amdec'
Private Sub TextDATEAM_Change()
'Code permettant de mettre une date au format 00/00/0000 dans une textbox
Dim valeur As Byte
TextDATEAM.MaxLength = 10 'nb caractères maxi autorisé dans le textbox
valeur = Len(TextDATEAM)
If valeur = 2 Or valeur = 5 Then TextDATEAM = TextDATEAM & "/"
End Sub
'format date de mise en service'
Private Sub Textmise_Change()
'Code permettant de mettre une date au format 00/00/0000 dans une textbox
Dim valeur As Byte
TextMISE.MaxLength = 10 'nb caractères maxi autorisé dans le textbox
valeur = Len(TextMISE)
If valeur = 2 Or valeur = 5 Then TextMISE = TextMISE & "/"
End Sub
'format date fin de vie'
Private Sub Textfinvie_Change()
'Code permettant de mettre une date au format 00/00/0000 dans une textbox
Dim valeur As Byte
TextFINVIE.MaxLength = 10 'nb caractères maxi autorisé dans le textbox
valeur = Len(TextFINVIE)
If valeur = 2 Or valeur = 5 Then TextFINVIE = TextFINVIE & "/"
End Sub
'format date de mise en service'
Private Sub TextREMPL_Change()
'Code permettant de mettre une date au format 00/00/0000 dans une textbox
Dim valeur As Byte
TextREMPL.MaxLength = 10 'nb caractères maxi autorisé dans le textbox
valeur = Len(TextREMPL)
If valeur = 2 Or valeur = 5 Then TextREMPL = TextREMPL & "/"
End Sub
'format date remplacement equipement '
Private Sub Textboxdatechange_Change()
'Code permettant de mettre une date au format 00/00/0000 dans une textbox
Dim valeur As Byte
Textboxdatechange.MaxLength = 10 'nb caractères maxi autorisé dans le textbox
valeur = Len(Textboxdatechange)
If valeur = 2 Or valeur = 5 Then Textboxdatechange = Textboxdatechange & "/"
End Sub |
Partager