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 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048
| Public confHum As Integer 'Humidité
Public confDens As Integer 'Densité
Public confTam1 As Integer 'Tamis 1
Public confTam2 As Integer 'Tamis 2
Public confTam3 As Integer 'Tamis 3
Public confTam4 As Integer 'Tamis 4
Public confTam5 As Integer 'Tamis 5
Public confSens As Integer 'Conformité Sensorielle
Public confLam As String 'Conformité Laminage
'Fonctions systèmes nécessaires à la désactivation du bouton "Croix de fermeture" de Mise_en_Forme
Private Const SC_CLOSE = &HF060&
Private Const MF_BYCOMMAND = &H0&
#If VBA7 Then 'Version x64
Private Declare PtrSafe Function GetSystemMenu Lib "user32" _
(ByVal hwnd As LongPtr, ByVal bRevert As LongPtr) As LongPtr
Private Declare PtrSafe Function RemoveMenu Lib "user32" _
(ByVal hMenu As LongPtr, ByVal nPosition As LongPtr, ByVal wFlags As LongPtr) As LongPtr
Private Declare PtrSafe Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
#Else 'Version x86 (32 bits)
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
#End If
Private Sub CommandButton1_Click()
'Incrémentation des informations du formulaire
ActiveSheet.Unprotect Sheets("MDP").Range("C6").Value
If Formulaire.TextBox10.Value = "Station BB" Then
Sheets("Rapport").ComboBox1.Value = "Bigbag"
Sheets("Rapport").Range("C7").Value = "Bigbag"
End If
Dim i As Integer
Application.ScreenUpdating = False
Sheets("Rapport").Activate
'Test du remplissage des champs du formulaire
If TextBox1 = "" Or TextBox2 = "" Or TextBox6 = "" Or TextBox7 = "" Or TextBox10 = "" Then
MsgBox "Merci de remplir tous les champs requis"
Else
i = 15
Do While Cells(i, 2) <> ""
Cells(i, 1).Offset(1, 0).Select
i = i + 1
Loop
'Si le formulaire est rempli :
If i <= 34 Then '(Si on i est inférieur à la ligne 34 : ligne maxi du formulaire)
On Error Resume Next
'Code d'exécution des actions sur la feuille
ActiveCell.Offset(0, 1) = Range("C2").Value 'fonction Maintenant() pour l'heure
ActiveCell.Offset(0, 2).Value = Range("AQ6").Value 'Humidité MIN
ActiveCell.Offset(0, 3).Value = (Range("AQ6").Value + Range("AR6").Value) / 2 'Interne Humidité MIN
ActiveCell.Offset(0, 4).Value = Formulaire.TextBox1.Value 'Humidité
ActiveCell.Offset(0, 5).Value = (Range("AR6").Value + Range("AS6").Value) / 2 'Interne Humidité MAX
ActiveCell.Offset(0, 6).Value = Range("AS6").Value 'Humidité MAX
ActiveCell.Offset(0, 8).Value = Range("AQ7").Value 'Densité MIN
ActiveCell.Offset(0, 9).Value = (Range("AQ7").Value + Range("AR7").Value) / 2 'Interne Densité MIN
ActiveCell.Offset(0, 10).Value = Formulaire.TextBox2.Value 'Densité
ActiveCell.Offset(0, 11).Value = (Range("AR7").Value + Range("AS7").Value) / 2 'Interne Densité MAX
ActiveCell.Offset(0, 12).Value = Range("AS7").Value 'Densité MAX
ActiveCell.Offset(0, 15).Value = Range("AQ8").Value 'Tamissage 1 MIN
ActiveCell.Offset(0, 14).Value = Formulaire.TextBox3.Value 'Tamissage 1
ActiveCell.Offset(0, 17).Value = Range("AS8").Value 'Tamissage 1 MAX
ActiveCell.Offset(0, 20).Value = Range("AQ9").Value 'Tamissage 2 MIN
ActiveCell.Offset(0, 19).Value = Formulaire.TextBox4.Value 'Tamissage 2
ActiveCell.Offset(0, 22).Value = Range("AS9").Value 'Tamissage 2 MAX
ActiveCell.Offset(0, 25).Value = Range("AQ10").Value 'Tamissage 3 MIN
ActiveCell.Offset(0, 24).Value = Formulaire.TextBox5.Value 'Tamissage 3
ActiveCell.Offset(0, 27).Value = Range("AS10").Value 'Tamissage 3 MAX
ActiveCell.Offset(0, 30).Value = Range("AQ11").Value 'Tamissage 4 MIN
ActiveCell.Offset(0, 29).Value = Formulaire.TextBox12.Value 'Tamissage 4
ActiveCell.Offset(0, 32).Value = Range("AS11").Value 'Tamissage 4 MAX
ActiveCell.Offset(0, 35).Value = Range("AQ12").Value 'Tamissage 5 MIN
ActiveCell.Offset(0, 34).Value = Formulaire.TextBox13.Value 'Tamissage 5
ActiveCell.Offset(0, 37).Value = Range("AS12").Value 'Tamissage 5 MAX
ActiveCell.Offset(0, 39).Value = Formulaire.TextBox6.Value 'Conformité sensoriel
ActiveCell.Offset(0, 40).Value = Formulaire.TextBox7.Value 'Grain ou laminé
ActiveCell.Offset(0, 41).Value = Formulaire.TextBox8.Value 'Remarques
ActiveCell.Offset(0, 43).Value = Formulaire.TextBox10.Value 'Destination du produit
ActiveCell.Offset(0, 42).Value = Formulaire.TextBox9.Value 'Débit
ActiveCell.Offset(0, 44).Value = Formulaire.TextBox14.Value 'T°C Zone 1 SAB
ActiveCell.Offset(0, 45).Value = Formulaire.TextBox15.Value 'T°C Zone 2 SAB
ActiveCell.Offset(0, 46).Value = Formulaire.TextBox16.Value 'Vitesse Zone 1 SAB
ActiveCell.Offset(0, 47).Value = Formulaire.TextBox17.Value 'Vitesse Zone Tempérée SAB
'Recupération des valeurs des variables dans les captions
'afin d'alimenter le formulaire "Non-conformité" :
Conformité.Label16.Caption = ActiveCell.Offset(0, 4).Value & " %" 'Humidité
Conformité.Label17.Caption = ActiveCell.Offset(0, 10).Value & " g/L" 'Densité
Conformité.Label23.Caption = ActiveCell.Offset(0, 39).Value 'Conformité Sensorielle
Conformité.Label24.Caption = ActiveCell.Offset(0, 40).Value 'Laminage
'Récupération de la valeur réel après calcul (%)
Conformité.Label18.Caption = ActiveCell.Offset(0, 16).Value 'Tamis 1
Conformité.Label19.Caption = ActiveCell.Offset(0, 21).Value 'Tamis 2
Conformité.Label20.Caption = ActiveCell.Offset(0, 26).Value 'Tamis 3
Conformité.Label22.Caption = ActiveCell.Offset(0, 31).Value 'Tamis 4
Conformité.Label21.Caption = ActiveCell.Offset(0, 36).Value 'Tamis 5
'Variables "Conformité" de changements des smileys (NC ou Conf) (valeurs : 1;2;3)
confHum = ActiveCell.Offset(0, 7).Value 'Humidité
confDens = ActiveCell.Offset(0, 13).Value 'Densité
confTam1 = ActiveCell.Offset(0, 18).Value 'Tamis 1
confTam2 = ActiveCell.Offset(0, 23).Value 'Tamis 2
confTam3 = ActiveCell.Offset(0, 28).Value 'Tamis 3
confTam4 = ActiveCell.Offset(0, 33).Value 'Tamis 4
confTam5 = ActiveCell.Offset(0, 38).Value 'Tamis 5
confSens = ActiveCell.Offset(0, 39).Value 'Conformité sensoriel
confLam = ActiveCell.Offset(0, 40).Value 'Grain ou laminé
'Autocomplétage des captions du formulaire "Conformité"
Conformité.Label3.Caption = Range("AO8").Value 'Tamis 1
Conformité.Label4.Caption = Range("AO9").Value 'Tamis 2
Conformité.Label5.Caption = Range("AO10").Value 'Tamis 3
Conformité.Label14.Caption = Range("AO11").Value 'Tamis 4
Conformité.Label15.Caption = Range("AO12").Value 'Tamis 5
'Si i > 34 lignes alors :
ElseIf i > 34 Then
Formulaire.Hide 'On cache le formulaire sans supprimer les données à l'intérieur
MsgBox "Vous avez atteint le nombre maximale d'informations dans le formulaire." & vbCr & vbCr & "Vous pouvez:" & vbCr & "- soit rouvrir un nouveau formulaire." & vbCr & "- soit supprimer les données à l'intérieur de celui-ci."
i = 15 'Alors on revient à la ligne 15
End If
End If
'Si on a une non-conformité sur
'L'humidité - La Densité - Les Tamis de 1 à 5 - conformité sensorielle - Laminage alors ... on affiche le formulaire "Conformité"
If confHum = 2 Or confDens = 2 Or confTam1 = 2 Or confTam2 = 2 Or confTam3 = 2 Or confTam4 = 2 Or confTam5 = 2 Or confSens = 2 Or confLam = "Présence" Then
Formulaire.Hide
'Vidage nécessaire de la textbox 8 (contenant les actions préventives/correctives) entre 2 saisies
Conformité.TextBox8.Text = ""
Conformité.TextBox8.Value = ""
'Affichage du formulaire :
Conformité.Show 0
'On affiche les smileys en fonction des variables du formulaire :
'Humidité
Select Case Formulaire.confHum
Case 2
Conformité.V1.Visible = False
Conformité.R1.Visible = True
Conformité.J1.Visible = False
Case 1
Conformité.V1.Visible = True
Conformité.R1.Visible = False
Conformité.J1.Visible = False
End Select
'Densité
Select Case Formulaire.confDens
Case 2
Conformité.V2.Visible = False
Conformité.R2.Visible = True
Conformité.J2.Visible = False
Case 1
Conformité.V2.Visible = True
Conformité.R2.Visible = False
Conformité.J2.Visible = False
End Select
'Conformité sensorielle
Select Case Formulaire.confSens
Case 0
Conformité.V8.Visible = False
Conformité.R8.Visible = True
Conformité.J8.Visible = False
Case 1
Conformité.V8.Visible = False
Conformité.R8.Visible = False
Conformité.J8.Visible = True
Case Else
Conformité.V8.Visible = True
Conformité.R8.Visible = False
Conformité.J8.Visible = False
End Select
' ------------------------------------------------
' Gestion des smileys des tamis
' ------------------------------------------------
If Nbtamis = 0 Then
'Conditionnement visuel de la fenêtre Conformité
Conformité.Frame2.Height = 35.95
Conformité.Frame3.Top = 108
Conformité.Frame4.Top = 150
Conformité.Frame5.Top = 192
Conformité.CommandButton1.Top = 270
Conformité.Frame1.Height = 318
Conformité.Height = 391.5
End If
If Nbtamis = 1 Then
'Fonctions d'affichages des smileys en fonction des tamis:
Tamis1
'Conditionnement visuel de la fenêtre Conformité
Conformité.Frame2.Height = 35.95
Conformité.Frame3.Top = 108
Conformité.Frame4.Top = 150
Conformité.Frame5.Top = 192
Conformité.CommandButton1.Top = 270
Conformité.Frame1.Height = 318
Conformité.Height = 391.5
End If
If Nbtamis = 2 Then
'Fonctions d'affichages des smileys en fonction des tamis:
Tamis1
Tamis2
'Conditionnement visuel de la fenêtre Conformité
Conformité.Frame2.Height = 53.95
Conformité.Frame3.Top = 126
Conformité.Frame4.Top = 168
Conformité.Frame5.Top = 210
Conformité.CommandButton1.Top = 288
Conformité.Frame1.Height = 336
Conformité.Height = 410.25
End If
If Nbtamis = 3 Then
'Fonctions d'affichages des smileys en fonction des tamis:
Tamis1
Tamis2
Tamis3
'Conditionnement visuel de la fenêtre Conformité
Conformité.Frame2.Height = 71.95
Conformité.Frame3.Top = 144
Conformité.Frame4.Top = 186
Conformité.Frame5.Top = 228
Conformité.CommandButton1.Top = 306
Conformité.Frame1.Height = 354
Conformité.Height = 427.5
End If
If Nbtamis = 4 Then
'Fonctions d'affichages des smileys en fonction des tamis:
Tamis1
Tamis2
Tamis3
Tamis4
'Conditionnement visuel de la fenêtre Conformité
Conformité.Frame2.Height = 89.95
Conformité.Frame3.Top = 162
Conformité.Frame4.Top = 204
Conformité.Frame5.Top = 246
Conformité.CommandButton1.Top = 324
Conformité.Frame1.Height = 372
Conformité.Height = 446.25
End If
If Nbtamis = 5 Then
'Fonctions d'affichages des smileys en fonction des tamis:
Tamis1
Tamis2
Tamis3
Tamis4
Tamis5
'Conditionnement visuel de la fenêtre Conformité
Conformité.Frame2.Height = 107.95
Conformité.Frame3.Top = 180
Conformité.Frame4.Top = 222
Conformité.Frame5.Top = 264
Conformité.CommandButton1.Top = 342
Conformité.Frame1.Height = 390
Conformité.Height = 463.5
End If
'Laminage
Select Case Formulaire.confLam
Case "Absence"
Conformité.V9.Visible = True
Conformité.R9.Visible = False
Conformité.J9.Visible = False
Case "Présence"
Conformité.V9.Visible = False
Conformité.R9.Visible = True
Conformité.J9.Visible = False
End Select
End If
Unload Formulaire
'Graph Humidité
ActiveSheet.ChartObjects("Graphique 1").Activate
With ActiveChart.Axes(xlValue)
YMin = Replace(Range("AQ6").Value, ".", ",")
YMax = Replace(Range("AS6").Value, ".", ",")
.MinimumScale = YMin - 0.5
.MaximumScale = YMax + 0.5
End With
'Graph Densité
ActiveSheet.ChartObjects("Graphique 2").Activate
With ActiveChart.Axes(xlValue)
YMin = Replace(Range("AQ7").Value, ".", ",")
YMax = Replace(Range("AS7").Value, ".", ",")
.MinimumScale = YMin - 5
.MaximumScale = YMax + 5
End With
ActiveSheet.Protect Sheets("MDP").Range("C6").Value, True, True, True
End Sub
Private Sub CommandButton2_Click()
'Bouton "Fermer" le formulaire
Formulaire.Hide
End Sub
Private Sub CommandButton4_Click()
'Bouton "Formulaire" permettant d'afficher le formulaire
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'Masquer le bouton "Croix de fermeture"
Dim hSysMenu As Long
Dim MeHwnd As Long
MeHwnd = FindWindowA(vbNullString, Modification.Caption)
If MeHwnd > 0 Then
hSysMenu = GetSystemMenu(MeHwnd, False)
RemoveMenu hSysMenu, SC_CLOSE, MF_BYCOMMAND
Else
MsgBox "Handle de " & Modification.Caption & " Introuvable", vbCritical
End If
'Affichage du formulaire "Modification"
Formulaire.Hide
Modification.Show 0
''Gestion des relevés de débits (toutes les 3h)
'Select Case Modification.TextBox9.Value
'Case ""
'Modification.TextBox9.Visible = False
'Modification.Label9.Caption = "Pas de relevé de débit à réaliser"
'Case Else
'Modification.TextBox9.Visible = True
'Modification.Label9.Caption = "Débit (T/h)"
'End Select
'Autocomplétage des Captions des différents tamis
Modification.Label3.Caption = Range("AO8").Value 'Tamis 1
Modification.Label4.Caption = Range("AO9").Value 'Tamis 2
Modification.Label5.Caption = Range("AO10").Value 'Tamis 3
Modification.Label16.Caption = Range("AO11").Value 'Tamis 4
Modification.Label17.Caption = Range("AO12").Value 'Tamis 5
'Désactivation de la visibilité des champs de remplissages
Modification.TextBox6.Visible = False 'Valeur de la conformité sensoriel
Modification.TextBox7.Visible = False 'Valeur du laminage
Modification.TextBox10.Visible = False 'Valeur de la destination du produit
'Gestion des indicateurs (têtes souriantes)
Modification.Vert.Visible = False
Modification.Jaune.Visible = False
Modification.Rouge.Visible = False
Modification.Vert2.Visible = False
Modification.Rouge2.Visible = False
'Gestion du remplissage des valeurs établis par l'utilisateur
'Conformité sensoriel
Select Case Modification.TextBox6.Value
Case "" 'Si on à aucune valeur
Modification.OptionButton1.Value = False
Modification.OptionButton2.Value = False
Modification.OptionButton3.Value = False
End Select
'Laminage
Select Case Modification.TextBox7.Value
Case "" 'Si on à aucune valeur
Modification.OptionButton4.Value = False
Modification.OptionButton5.Value = False
End Select
'Destination du produit
Select Case Modification.TextBox10.Value
Case ""
Modification.OptionButton6.Value = False
Modification.OptionButton7.Value = False
Modification.OptionButton8.Value = False
End Select
Select Case Range("B1").Value 'Selection multiple de tous les cas de tamissages (de 0 à 5 tamis)
' ------------------------------------------------
' Si on a 0 tamissage
' ------------------------------------------------
Case 0
'// MODE Standard (sur deux colonnes)
Modification.Label3.Visible = True 'Tamis 1
Modification.Label3.Caption = "Pas de tamissage" 'Commentaire "Pas de tamissage"
Modification.Label4.Visible = False 'Tamis 2
Modification.Label5.Visible = False 'Tamis 3
Modification.Label16.Visible = False 'Tamis 4
Modification.Label17.Visible = False 'Tamis 5
Modification.TextBox3.Visible = False
Modification.TextBox4.Visible = False
Modification.TextBox5.Visible = False
Modification.TextBox12.Visible = False
Modification.TextBox13.Visible = False
' ------------------------------------------------
' Si on a 1 tamissage
' ------------------------------------------------
Case 1
'// MODE Standard (sur deux colonnes)
Modification.Label3.Visible = True 'Tamis 1
Modification.Label4.Visible = False 'Tamis 2
Modification.Label5.Visible = False 'Tamis 3
Modification.Label16.Visible = False 'Tamis 4
Modification.Label17.Visible = False 'Tamis 5
Modification.TextBox3.Visible = True
Modification.TextBox4.Visible = False
Modification.TextBox5.Visible = False
Modification.TextBox12.Visible = False
Modification.TextBox13.Visible = False
' ------------------------------------------------
' Si on a 2 tamissages
' ------------------------------------------------
Case 2
'// MODE Standard (sur deux colonnes)
Modification.Label3.Visible = True 'Tamis 1
Modification.Label4.Visible = True 'Tamis 2
Modification.Label5.Visible = False 'Tamis 3
Modification.Label16.Visible = False 'Tamis 4
Modification.Label17.Visible = False 'Tamis 5
Modification.TextBox3.Visible = True
Modification.TextBox4.Visible = True
Modification.TextBox5.Visible = False
Modification.TextBox12.Visible = False
Modification.TextBox13.Visible = False
' ------------------------------------------------
' Si on a 3 tamissages
' ------------------------------------------------
Case 3
'// MODE Standard (sur deux colonnes)
Modification.Label3.Visible = True 'Tamis 1
Modification.Label4.Visible = True 'Tamis 2
Modification.Label5.Visible = True 'Tamis 3
Modification.Label16.Visible = False 'Tamis 4
Modification.Label17.Visible = False 'Tamis 5
Modification.TextBox3.Visible = True
Modification.TextBox4.Visible = True
Modification.TextBox5.Visible = True
Modification.TextBox12.Visible = False
Modification.TextBox13.Visible = False
' ------------------------------------------------
' Si on a 4 tamissages
' ------------------------------------------------
Case 4
'// MODE Standard (sur deux colonnes)
Modification.Label3.Visible = True 'Tamis 1
Modification.Label4.Visible = True 'Tamis 2
Modification.Label5.Visible = True 'Tamis 3
Modification.Label16.Visible = True 'Tamis 4
Modification.Label17.Visible = False 'Tamis 5
Modification.TextBox3.Visible = True
Modification.TextBox4.Visible = True
Modification.TextBox5.Visible = True
Modification.TextBox12.Visible = True
Modification.TextBox13.Visible = False
' ------------------------------------------------
' Si on a 5 tamissages
' ------------------------------------------------
Case 5
'// MODE Standard (sur deux colonnes)
'Pas de code = Normal
End Select
End Sub
Private Sub CommandButton5_Click()
Sheets("Rapport").Unprotect Sheets("MDP").Range("C6").Value
Dim i As Integer
i = 15
Do While Cells(i, 2) <> ""
i = i + 1
Loop
'Désignation de la variable Lg (commencement de l'index à la ligne 15)
Lg = i - 1
On Error Resume Next
'Remplissage des Textbox de modifications :
Formulaire.TextBox1 = CDbl(Cells(Lg, 5)) 'Humidité
Formulaire.TextBox1 = Replace(Formulaire.TextBox1, ",", ".")
If Formulaire.TextBox1 = 0 Then
Formulaire.TextBox1 = ""
End If
Formulaire.TextBox2 = CDbl(Cells(Lg, 11)) 'Densité
Formulaire.TextBox2 = Replace(Formulaire.TextBox2, ",", ".")
If Formulaire.TextBox2 = 0 Then
Formulaire.TextBox2 = ""
End If
Formulaire.TextBox3 = CDbl(Cells(Lg, 15)) 'Tamissage 1
Formulaire.TextBox3 = Replace(Formulaire.TextBox3, ",", ".")
If Formulaire.TextBox3 = 0 Then
Formulaire.TextBox3 = ""
End If
Formulaire.TextBox4 = CDbl(Cells(Lg, 20)) 'Tamissage 2
Formulaire.TextBox4 = Replace(Formulaire.TextBox4, ",", ".")
If Formulaire.TextBox4 = 0 Then
Formulaire.TextBox4 = ""
End If
Formulaire.TextBox5 = CDbl(Cells(Lg, 25)) 'Tamissage 3
Formulaire.TextBox5 = Replace(Formulaire.TextBox5, ",", ".")
If Formulaire.TextBox5 = 0 Then
Formulaire.TextBox5 = ""
End If
Formulaire.TextBox12 = CDbl(Cells(Lg, 30)) 'Tamissage 4
Formulaire.TextBox12 = Replace(Formulaire.TextBox12, ",", ".")
If Formulaire.TextBox12 = 0 Then
Formulaire.TextBox12 = ""
End If
Formulaire.TextBox13 = CDbl(Cells(Lg, 35)) 'Tamissage 5
Formulaire.TextBox13 = Replace(Formulaire.TextBox13, ",", ".")
If Formulaire.TextBox13 = 0 Then
Formulaire.TextBox13 = ""
End If
Formulaire.TextBox6 = Cells(Lg, 40) 'Conformité Sensoriel ?
Formulaire.TextBox7 = Cells(Lg, 41) 'Grain ou laminé ?
'Remarques
If Cells(Lg, 42) = "Remarques" Then
Formulaire.TextBox8 = ""
Else
Formulaire.TextBox8 = Cells(Lg, 42)
End If
If Formulaire.TextBox8 = 0 Then
Formulaire.TextBox8 = ""
End If
Formulaire.TextBox9 = CDbl(Cells(Lg, 43)) 'Débit
Formulaire.TextBox9 = Replace(Formulaire.TextBox9, ",", ".")
If Formulaire.TextBox9 = 0 Then
Formulaire.TextBox9 = ""
End If
Formulaire.TextBox10 = Cells(Lg, 44) 'Destination du produit
Formulaire.TextBox10 = Cells(Lg, 44) 'Destination du produit
nbcaract = Len(Formulaire.TextBox10.Text) 'On compte le nombre de caractère dans le textbox
Formulaire.TextBox18.Value = Right(Formulaire.TextBox10.Value, nbcaract - 1) 'Destination du produit
If Formulaire.TextBox18 = "C0" Then
Formulaire.TextBox10 = ""
Formulaire.TextBox18 = ""
Formulaire.TextBox18.Visible = False
Formulaire.OptionButton6.BackColor = &H8000000F
Formulaire.OptionButton6.Value = False
Formulaire.OptionButton7.BackColor = &H8000000F
Formulaire.OptionButton7.Value = False
Formulaire.OptionButton8.BackColor = &H8000000F
Formulaire.OptionButton8.Value = False
End If
Formulaire.TextBox14 = CDbl(Cells(Lg, 45)) 'T°C Zone 1 SAB
Formulaire.TextBox14 = Replace(Formulaire.TextBox14, ",", ".")
If Formulaire.TextBox14 = 0 Then
Formulaire.TextBox14 = ""
End If
Formulaire.TextBox15 = CDbl(Cells(Lg, 46)) 'T°C Zone 2 SAB
Formulaire.TextBox15 = Replace(Formulaire.TextBox15, ",", ".")
If Formulaire.TextBox15 = 0 Then
Formulaire.TextBox15 = ""
End If
Formulaire.TextBox16 = CDbl(Cells(Lg, 47)) 'Vitesse Zone 1 SAB
Formulaire.TextBox16 = Replace(Formulaire.TextBox16, ",", ".")
If Formulaire.TextBox16 = 0 Then
Formulaire.TextBox16 = ""
End If
Formulaire.TextBox17 = CDbl(Cells(Lg, 48)) 'Vitesse Zone Tempérée SAB
Formulaire.TextBox17 = Replace(Formulaire.TextBox17, ",", ".")
If Formulaire.TextBox17 = 0 Then
Formulaire.TextBox17 = ""
End If
Sheets("Rapport").Protect Sheets("MDP").Range("C6").Value
End Sub
Private Sub TextBox10_Change()
'Gestion des checkboxs de destination du produit
Select Case Formulaire.TextBox10.Value
Case "Destination du produit"
Formulaire.OptionButton6.Value = False
Formulaire.OptionButton7.Value = False
Formulaire.OptionButton8.Value = False
Formulaire.OptionButton6.BackColor = &H8000000F
Formulaire.OptionButton7.BackColor = &H8000000F
Formulaire.OptionButton8.BackColor = &H8000000F
Formulaire.TextBox18.Value = ""
Formulaire.TextBox10.Value = ""
Case ""
Formulaire.OptionButton6.Value = False
Formulaire.OptionButton7.Value = False
Formulaire.OptionButton8.Value = False
Formulaire.OptionButton6.BackColor = &H8000000F
Formulaire.OptionButton7.BackColor = &H8000000F
Formulaire.OptionButton8.BackColor = &H8000000F
Formulaire.TextBox18.Value = ""
Formulaire.TextBox10.Value = ""
Case "C" & "*" 'Si on a rien
Formulaire.OptionButton6.Value = False
Formulaire.OptionButton7.Value = False
Formulaire.OptionButton8.Value = False
Formulaire.TextBox18.Visible = False
Formulaire.TextBox18.Value = ""
Formulaire.TextBox10.Value = ""
Formulaire.OptionButton6.BackColor = &H8000000F
Formulaire.OptionButton7.BackColor = &H8000000F
Formulaire.OptionButton8.BackColor = &H8000000F
Case "Directe" 'Ligne de conditionnement
Formulaire.OptionButton6.Value = False
Formulaire.OptionButton7.Value = True
Formulaire.OptionButton8.Value = False
Case "Cte" 'Ligne de conditionnement
Formulaire.TextBox10.Value = "Directe"
Formulaire.TextBox18.Value = ""
Formulaire.OptionButton6.Value = False
Formulaire.OptionButton7.Value = True
Formulaire.OptionButton8.Value = False
Case "Station BB" 'Station Big Bag
Formulaire.OptionButton6.Value = False
Formulaire.OptionButton7.Value = False
Formulaire.OptionButton8.Value = True
Case "Cn BB" 'Station Big Bag
Formulaire.TextBox10.Value = "Station BB"
Formulaire.TextBox18.Value = ""
Formulaire.OptionButton6.Value = False
Formulaire.OptionButton7.Value = False
Formulaire.OptionButton8.Value = True
Case Else 'Container
Formulaire.OptionButton6.Value = True
Formulaire.OptionButton7.Value = False
Formulaire.OptionButton8.Value = False
Formulaire.TextBox18.Visible = True
End Select
End Sub
Private Sub TextBox18_AfterUpdate()
If Formulaire.TextBox18.Value <> "" Then
'Gestion de l'OptionButton 18 et de sa valeur (Container + n°)
Formulaire.TextBox10.Value = "C" & Formulaire.TextBox18.Value
End If
End Sub
Private Sub TextBox6_Change()
'Gestion du remplissage des valeurs établis par l'utilisateur
Select Case Formulaire.TextBox6.Value
'Conformité sensoriel
Case ""
'Si on à aucune valeur
Formulaire.OptionButton1.Value = False
Formulaire.OptionButton2.Value = False
Formulaire.OptionButton3.Value = False
Formulaire.OptionButton1.BackColor = &H8000000F
Formulaire.OptionButton2.BackColor = &H8000000F
Formulaire.OptionButton3.BackColor = &H8000000F
Formulaire.Vert.Visible = False
Formulaire.Rouge.Visible = False
Formulaire.Jaune.Visible = False
Case 0 'Conforme
Formulaire.OptionButton1.Value = False
Formulaire.OptionButton2.Value = False
Formulaire.OptionButton3.Value = True
Formulaire.OptionButton1.BackColor = &H8000000F
Formulaire.OptionButton2.BackColor = &H8000000F
Formulaire.OptionButton3.BackColor = &HFF&
Case 1 'A corriger
Formulaire.OptionButton1.Value = False
Formulaire.OptionButton2.Value = True
Formulaire.OptionButton3.Value = False
Formulaire.OptionButton1.BackColor = &H8000000F
Formulaire.OptionButton2.BackColor = &HFFFF&
Formulaire.OptionButton3.BackColor = &H8000000F
Case 2 'Non-conforme
Formulaire.OptionButton1.Value = True
Formulaire.OptionButton2.Value = False
Formulaire.OptionButton3.Value = False
Formulaire.OptionButton1.BackColor = &HFF00&
Formulaire.OptionButton2.BackColor = &H8000000F
Formulaire.OptionButton3.BackColor = &H8000000F
End Select
End Sub
Private Sub TextBox7_Change()
Select Case Formulaire.TextBox7.Value
Case "" 'Si on à aucune valeur
Formulaire.OptionButton4.Value = False
Formulaire.OptionButton5.Value = False
Formulaire.OptionButton4.BackColor = &H8000000F
Formulaire.OptionButton5.BackColor = &H8000000F
Formulaire.Vert2.Visible = False
Formulaire.Rouge2.Visible = False
Case "Absence" 'Laminé
Formulaire.OptionButton4.Value = True
Formulaire.OptionButton5.Value = False
Formulaire.OptionButton4.BackColor = &HFF00&
Formulaire.OptionButton5.BackColor = &H8000000F
Case "Présence" 'Non laminé
Formulaire.OptionButton4.Value = False
Formulaire.OptionButton5.Value = True
Formulaire.OptionButton4.BackColor = &H8000000F
Formulaire.OptionButton5.BackColor = &HFF&
End Select
End Sub
Private Sub OptionButton1_Click() 'Formulaire
'Gestion des couleurs de l'OptionButton 1 et de sa valeur (Conformité sensoriel)
Formulaire.TextBox6.Value = 2
Formulaire.Vert.Visible = True
Formulaire.Jaune.Visible = False
Formulaire.Rouge.Visible = False
Formulaire.OptionButton1.BackColor = &HFF00&
Formulaire.OptionButton2.BackColor = &H8000000F
Formulaire.OptionButton2.Value = False
Formulaire.OptionButton3.BackColor = &H8000000F
Formulaire.OptionButton3.Value = False
End Sub
Private Sub OptionButton2_Click() 'Formulaire
'Gestion des couleurs de l'OptionButton 2 et de sa valeur (Conformité sensoriel)
Formulaire.TextBox6.Value = 1
Formulaire.Vert.Visible = False
Formulaire.Jaune.Visible = True
Formulaire.Rouge.Visible = False
Formulaire.OptionButton1.BackColor = &H8000000F
Formulaire.OptionButton1.Value = False
Formulaire.OptionButton2.BackColor = &HFFFF&
Formulaire.OptionButton3.BackColor = &H8000000F
Formulaire.OptionButton3.Value = False
End Sub
Private Sub OptionButton3_Click() 'Formulaire
'Gestion des couleurs de l'OptionButton 3 et de sa valeur (Conformité sensoriel)
Formulaire.TextBox6.Value = 0
Formulaire.Vert.Visible = False
Formulaire.Jaune.Visible = False
Formulaire.Rouge.Visible = True
Formulaire.OptionButton1.BackColor = &H8000000F
Formulaire.OptionButton1.Value = False
Formulaire.OptionButton2.BackColor = &H8000000F
Formulaire.OptionButton2.Value = False
Formulaire.OptionButton3.BackColor = &HFF&
End Sub
Private Sub OptionButton4_Click() 'Formulaire
'Gestion des couleurs de l'OptionButton 4 et de sa valeur (Laminé)
Formulaire.TextBox7.Value = "Absence"
Formulaire.Vert2.Visible = True
Formulaire.Rouge2.Visible = False
Formulaire.OptionButton4.BackColor = &HFF00&
Formulaire.OptionButton5.BackColor = &H8000000F
Formulaire.OptionButton5.Value = False
End Sub
Private Sub OptionButton5_Click() 'Formulaire
'Gestion des couleurs de l'OptionButton 5 et de sa valeur (Non-laminé)
Formulaire.TextBox7.Value = "Présence"
Formulaire.Vert2.Visible = False
Formulaire.Rouge2.Visible = True
Formulaire.OptionButton5.BackColor = &HFF&
Formulaire.OptionButton4.BackColor = &H8000000F
Formulaire.OptionButton4.Value = False
End Sub
Private Sub OptionButton6_Click()
'Gestion des couleurs de l'OptionButton 6 et de sa valeur (Container + n°)
Range("AN4").Value = 0
Formulaire.TextBox10.Value = "C" & Formulaire.TextBox18.Value
Formulaire.TextBox18.Visible = True
Formulaire.OptionButton6.BackColor = RGB(150, 150, 150)
Formulaire.OptionButton7.BackColor = &H8000000F
Formulaire.OptionButton7.Value = False
Formulaire.OptionButton8.BackColor = &H8000000F
Formulaire.OptionButton8.Value = False
Formulaire.OptionButton9.BackColor = &H8000000F
Formulaire.OptionButton9.Value = False
End Sub
Private Sub OptionButton7_Click()
'Gestion des couleurs de l'OptionButton 7 et de sa valeur (Ligne de conditionnement)
Range("AN4").Value = 0
Formulaire.TextBox18.Visible = False
Formulaire.TextBox10.Value = "Directe"
Formulaire.OptionButton7.BackColor = RGB(150, 150, 150)
Formulaire.OptionButton6.BackColor = &H8000000F
Formulaire.OptionButton6.Value = False
Formulaire.OptionButton8.BackColor = &H8000000F
Formulaire.OptionButton8.Value = False
Formulaire.OptionButton9.BackColor = &H8000000F
Formulaire.OptionButton9.Value = False
End Sub
Private Sub OptionButton8_Click()
'Gestion des couleurs de l'OptionButton 8 et de sa valeur (Station BB)
Range("AN4").Value = 0
Formulaire.TextBox18.Visible = False
Formulaire.TextBox10.Value = "Station BB"
Formulaire.OptionButton8.BackColor = RGB(150, 150, 150)
Formulaire.OptionButton6.BackColor = &H8000000F
Formulaire.OptionButton6.Value = False
Formulaire.OptionButton7.BackColor = &H8000000F
Formulaire.OptionButton7.Value = False
Formulaire.OptionButton9.BackColor = &H8000000F
Formulaire.OptionButton9.Value = False
End Sub
Private Sub OptionButton9_Click()
'Gestion des couleurs de l'OptionButton 8 et de sa valeur (Enrobage)
Range("AN4").Value = 1
Formulaire.TextBox18.Visible = False
Formulaire.TextBox10.Value = "Enrobage"
Formulaire.OptionButton8.BackColor = &H8000000F
Formulaire.OptionButton8.Value = False
Formulaire.OptionButton6.BackColor = &H8000000F
Formulaire.OptionButton6.Value = False
Formulaire.OptionButton7.BackColor = &H8000000F
Formulaire.OptionButton7.Value = False
Formulaire.OptionButton9.BackColor = RGB(150, 150, 150)
End Sub
Private Sub TextBox11_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
'On oblige la Textbox11 l'insertion de caractère alphabétique
Select Case KeyCode
Case 48 To 57: KeyCode = 0
Case 96 To 105: KeyCode = 0
End Select
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'On oblige la Textbox1 l'insertion de caractère numérique
If InStr("0123456789.,", Chr(KeyAscii)) = 0 Then KeyAscii = 0: Beep
End Sub
Private Sub TextBox18_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'On oblige la Textbox2 l'insertion de caractère numérique
If InStr("0123456789", Chr(KeyAscii)) = 0 Then KeyAscii = 0: Beep
End Sub
Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'On oblige la Textbox2 l'insertion de caractère numérique
If InStr("0123456789.,", Chr(KeyAscii)) = 0 Then KeyAscii = 0: Beep
End Sub
Private Sub TextBox3_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'On oblige la Textbox3 l'insertion de caractère numérique
If InStr("0123456789.,", Chr(KeyAscii)) = 0 Then KeyAscii = 0: Beep
End Sub
Private Sub TextBox4_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'On oblige la Textbox4 l'insertion de caractère numérique
If InStr("0123456789.,", Chr(KeyAscii)) = 0 Then KeyAscii = 0: Beep
End Sub
Private Sub TextBox5_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'On oblige la Textbox5 l'insertion de caractère numérique
If InStr("0123456789.,", Chr(KeyAscii)) = 0 Then KeyAscii = 0: Beep
End Sub
Private Sub TextBox12_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'On oblige la Textbox12 l'insertion de caractère numérique
If InStr("0123456789.,", Chr(KeyAscii)) = 0 Then KeyAscii = 0: Beep
End Sub
Private Sub TextBox13_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'On oblige la Textbox13 l'insertion de caractère numérique
If InStr("0123456789.,", Chr(KeyAscii)) = 0 Then KeyAscii = 0: Beep
End Sub
Private Sub TextBox6_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
'On oblige la Textbox6 l'insertion de caractère alphabétique
Select Case KeyCode
Case 48 To 57: KeyCode = 0
Case 96 To 105: KeyCode = 0
End Select
End Sub
Private Sub TextBox7_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
'On oblige la Textbox7 l'insertion de caractère alphabétique
Select Case KeyCode
Case 48 To 57: KeyCode = 0
Case 96 To 105: KeyCode = 0
End Select
End Sub
Private Sub TextBox9_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'On oblige la Textbox9 l'insertion de caractère alphabétique
If InStr("0123456789.,T", Chr(KeyAscii)) = 0 Then KeyAscii = 0: Beep
End Sub
Private Sub TextBox14_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'On oblige la Textbox13 l'insertion de caractère numérique
If InStr("0123456789.,", Chr(KeyAscii)) = 0 Then KeyAscii = 0: Beep
End Sub
Private Sub TextBox15_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'On oblige la Textbox13 l'insertion de caractère numérique
If InStr("0123456789.,", Chr(KeyAscii)) = 0 Then KeyAscii = 0: Beep
End Sub
Private Sub TextBox16_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'On oblige la Textbox13 l'insertion de caractère numérique
If InStr("0123456789.,", Chr(KeyAscii)) = 0 Then KeyAscii = 0: Beep
End Sub
Private Sub TextBox17_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'On oblige la Textbox13 l'insertion de caractère numérique
If InStr("0123456789.,", Chr(KeyAscii)) = 0 Then KeyAscii = 0: Beep
End Sub
'Fonctions d'affichages des smileys en fonction des tamis :
Function Tamis1()
Select Case Formulaire.confTam1
Case 2
Conformité.V3.Visible = False
Conformité.R3.Visible = True
Conformité.J3.Visible = False
Case 1
Conformité.V3.Visible = True
Conformité.R3.Visible = False
Conformité.J3.Visible = False
Case Else
Conformité.V3.Visible = False
Conformité.R3.Visible = False
Conformité.J3.Visible = False
End Select
End Function
Function Tamis2()
Select Case Formulaire.confTam2
Case 2
Conformité.V4.Visible = False
Conformité.R4.Visible = True
Conformité.J4.Visible = False
Case 1
Conformité.V4.Visible = True
Conformité.R4.Visible = False
Conformité.J4.Visible = False
Case Else
Conformité.V4.Visible = False
Conformité.R4.Visible = False
Conformité.J4.Visible = False
End Select
End Function
Function Tamis3()
Select Case Formulaire.confTam3
Case 2
Conformité.V5.Visible = False
Conformité.R5.Visible = True
Conformité.J5.Visible = False
Case 1
Conformité.V5.Visible = True
Conformité.R5.Visible = False
Conformité.J5.Visible = False
Case Else
Conformité.V5.Visible = False
Conformité.R5.Visible = False
Conformité.J5.Visible = False
End Select
End Function
Function Tamis4()
Select Case Formulaire.confTam4
Case 2
Conformité.V6.Visible = False
Conformité.R6.Visible = True
Conformité.J6.Visible = False
Case 1
Conformité.V6.Visible = True
Conformité.R6.Visible = False
Conformité.J6.Visible = False
Case Else
Conformité.V6.Visible = False
Conformité.R6.Visible = False
Conformité.J6.Visible = False
End Select
End Function
Function Tamis5()
Select Case Formulaire.confTam5
Case 2
Conformité.V7.Visible = False
Conformité.R7.Visible = True
Conformité.J7.Visible = False
Case 1
Conformité.V7.Visible = True
Conformité.R7.Visible = False
Conformité.J7.Visible = False
Case Else
Conformité.V7.Visible = False
Conformité.R7.Visible = False
Conformité.J7.Visible = False
End Select
End Function |
Partager