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
| APPELE DES DONNEE'
Private Sub ComboBox5_Change()
Dim Ligne As Integer
Cells(ComboBox5.ListIndex + 10, 1).EntireRow.Select 'sélectionne la ligne correspondante
With ThisWorkbook.Sheets("00-Recap")
Ligne = .Columns("B").Find(Me.ComboBox5.Value, .Range("B10"), xlValues).Row 'ligne dans la colone B
Me.TextBoxobjet.Value = .Cells(Ligne, "C") 'colone c'
Me.ComboBox6.Value = .Cells(Ligne, "BZ") 'colone BZ' 'INDICE DE LA FICHE
Me.ComboBox4.Value = .Cells(Ligne, "BA") 'colone BA'
Me.TextBoxfiche.Value = .Cells(Ligne, "BB") 'colone BB'
Me.TextBoxdate.Value = .Cells(Ligne, "BC") 'colone BC'
Me.TextBoximputation.Value = .Cells(Ligne, "BD") 'colone BD'
Me.TextBoxlocalisation.Value = .Cells(Ligne, "BE") 'colone BE'
Me.ComboBox1.Value = .Cells(Ligne, "BF") 'colone BF'
Me.TextBoxannée.Value = .Cells(Ligne, "BG") 'colone BG'
Me.CheckBox1.Value = .Cells(Ligne, "BH") 'colone BH'
Me.CheckBox2.Value = .Cells(Ligne, "BI") 'colone BI'
Me.CheckBox3.Value = .Cells(Ligne, "BJ") 'colone BJ'
Me.ComboBoxCONSTAT.Value = .Cells(Ligne, "BK") 'colone BK
Me.ComboBoxRISQUE.Value = .Cells(Ligne, "BL") 'colone BL'
Me.ComboBoxORIGINE.Value = .Cells(Ligne, "BM") 'colone BM'
Me.CheckBox4.Value = .Cells(Ligne, "BN") 'colone BN'
Me.CheckBox5.Value = .Cells(Ligne, "BO") 'colone BO'
Me.CheckBox6.Value = .Cells(Ligne, "BP") 'colone BP'
Me.ComboBoxTRAVAUX.Value = .Cells(Ligne, "BQ") 'colone BQ'
Me.CheckBox7.Value = .Cells(Ligne, "BR") 'colone BR'
Me.CheckBox8.Value = .Cells(Ligne, "BS") 'colone BS'
Me.CheckBox9.Value = .Cells(Ligne, "BT") 'colone BT'
Me.ComboBoxOBSERVATION.Value = .Cells(Ligne, "BU") 'colone BU
Me.ComboBoXCONSTRUCTEUR.Value = .Cells(Ligne, "BV") 'colone BV'
Me.TextBoxdureevie1.Value = .Cells(Ligne, "BW") 'colone BW'
Me.TextBoxdureevie2.Value = .Cells(Ligne, "BX") 'colone BX'
Me.TextBoxfacturation.Value = .Cells(Ligne, "V") 'colone V'
Me.ComboBoxECRIT.Value = .Cells(Ligne, "N") 'DOE PIECE ECRITE colone N'
Me.ComboBoxGRAPH.Value = .Cells(Ligne, "O") 'DOE PIECE GRAPHIQUE colone O
Me.ComboBoxMAINTENANCE.Value = .Cells(Ligne, "P") 'DOE PIECE MAINTENANCE colone P
Me.TextBoxtotal7.Value = .Cells(Ligne, "CA") 'colone CA'
End With
End Sub
Private Sub CommandButton2_Click()
Dim Ligne As Integer
Dim laconcat As String
Dim ctl As Control
With ThisWorkbook.Sheets("00-Recap")
Ligne = .Columns("B").Find(Me.ComboBox5.Value, .Range("b10"), xlValues).Row 'sélectionne la ligne correspondante
.Range("C" & Ligne).Value = TextBoxobjet 'OBJET DE LA FICHE
.Range("BA" & Ligne).Value = ComboBox4 'LES INITIALEs DU SITE
.Range("BB" & Ligne).Value = TextBoxfiche ' LE N° DE LA FICHE
.Range("BC" & Ligne).Value = CDate(TextBoxdate) 'LA DATE DE LA FICHE
.Range("BD" & Ligne).Value = TextBoximputation ' LE CODE IMPUTATION
.Range("BE" & Ligne).Value = TextBoxlocalisation ' LE NUMERO DU LOCAL
.Range("BF" & Ligne).Value = ComboBox1 'LES INITIAL CODE METIER
.Range("D" & Ligne).Value = ComboBox1 'LES INITIAL CODE METIER
.Range("BG" & Ligne).Value = TextBoxannée 'L'ANNEE QUI PERMET DE CONSTRUITE LE CODE ONGLET ET FICHE
.Range("BH" & Ligne).Value = CheckBox1 'CASE A COCHE CONSTAT INTERNE
.Range("BI" & Ligne).Value = CheckBox2 'CASE A COCHE CONSTAT SOUS-TRAITANT
.Range("BJ" & Ligne).Value = CheckBox3 'CASE A COCHE CONSTAT ADMINISTRATION
.Range("BK" & Ligne).Value = ComboBoxCONSTAT ' LE CONSTAT DE LA FICHE
.Range("BL" & Ligne).Value = ComboBoxRISQUE 'risque de la fiche
.Range("BZ" & Ligne).Value = ComboBox6 ' indice de la fiche
.Range("BM" & Ligne).Value = ComboBoxORIGINE 'origine de la fiche
.Range("BN" & Ligne).Value = CheckBox4 'CASE A COCHE chargement reglementaire
.Range("BO" & Ligne).Value = CheckBox5 'CASE A COCHE obsolesence
.Range("BP" & Ligne).Value = CheckBox6 'CASE A COCHE vetusté
.Range("BQ" & Ligne).Value = ComboBoxTRAVAUX 'description en travaux
.Range("BR" & Ligne).Value = CheckBox7 'CASE A COCHE nouvelle equipement dernier generation
.Range("BS" & Ligne).Value = CheckBox8 'CASE A COCHE nouvelle equipement equivalent autre marque
.Range("BT" & Ligne).Value = CheckBox9 'CASE A COCHE autres
.Range("V" & Ligne).Value = TextBoxfacturation 'facturation
.Range("BU" & Ligne).Value = ComboBoxOBSERVATION 'osbservation de la fiche
.Range("BV" & Ligne).Value = ComboBoXCONSTRUCTEUR 'preco constructeur fiche
.Range("BW" & Ligne).Value = TextBoxdureevie1 'DUREE DE VIE THEORIQUE
.Range("BX" & Ligne).Value = TextBoxdureevie2 'DUREE DE VIE NOUVEL EQUIPEMENT
.Range("N" & Ligne).Value = ComboBoxECRIT 'DOE PIECE ECRITE
.Range("O" & Ligne).Value = ComboBoxGRAPH 'DOE PIECE GRAPHIQUE
.Range("P" & Ligne).Value = ComboBoxMAINTENANCE 'DOE PIECE MAINTENANCE
laconcat = ComboBox4.Value & "_" & TextBoxannée.Text & "_" & TextBoxfiche.Text & "_" & ComboBox6.Value 'Concatener les valeur des textbox suivant
.Range("B" & Ligne).Value = laconcat
End With
With Sheets(ComboBox5.Value) 'inscris les valeurs dans la fiche selection dans le combox
.Range("K1").Value = laconcat
.Range("B3") = TextBoxobjet
.Range("A6") = TextBoxfiche
.Range("B6") = TextBoxdate
.Range("C6") = TextBoximputation
.Range("D6") = TextBoxlocalisation
.Range("E6") = ComboBox1
.Range("F6") = TextBoxannée
.Range("G6") = ComboBox4
.Range("A9") = ComboBoxCONSTAT
.Range("E11") = CheckBox1
.Range("E12") = CheckBox2
.Range("E13") = CheckBox3
.Range("A16") = ComboBoxRISQUE
.Range("A21") = ComboBoxORIGINE
.Range("E23") = CheckBox4
.Range("E24") = CheckBox5
.Range("E25") = CheckBox6
.Range("A28") = ComboBoxTRAVAUX
.Range("E31") = CheckBox7
.Range("E32") = CheckBox8
.Range("E33") = CheckBox9
.Range("A36") = ComboBoxOBSERVATION
.Range("H15") = ComboBoXCONSTRUCTEUR
.Range("K17") = TextBoxdureevie1
.Range("K18") = TextBoxdureevie2
End With
Unload UserForm3
End Sub
Private Sub Textboxdate_Change()
'Code permettant de mettre une date au format 00/00/0000 dans une textbox
Dim valeur As Byte
TextBoxdate.MaxLength = 8 'nb caractères maxi autorisé dans le textbox
valeur = Len(TextBoxdate)
If valeur = 2 Or valeur = 5 Then TextBoxdate = TextBoxdate & "/"
End Sub
'COLORIE LA LIGNE EN ORANGE COCHE LA CASE
Private Sub CheckBox10_Click()
Dim sh As Worksheet, c As Range
If ComboBox5 = "" Then
Application.EnableEvents = False
CheckBox10 = True
Application.EnableEvents = False
Exit Sub
End If
Set sh = Worksheets("00-recap")
Set c = sh.[B:B].Find(ComboBox5, LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
MsgBox ("Dossier non trouvé")
Exit Sub
Else
If Cells(c.Row, "B").Interior.ColorIndex = xlNone Or Cells(c.Row, "B").Interior.ColorIndex = 2 Then
c.Resize(1, 77).Interior.ColorIndex = sh.[C1].Interior.ColorIndex
Else
c.Resize(1, 77).Interior.ColorIndex = xlNone
End If
End If
End Sub
'COLORIE LA LIGNE EN BLEU COCHE LA CASE
Private Sub CheckBox11_Click()
Dim sh As Worksheet, c As Range
If ComboBox5 = "" Then
Application.EnableEvents = False
CheckBox11 = False
Application.EnableEvents = False
Exit Sub
End If
Set sh = Worksheets("00-recap")
Set c = sh.[B:B].Find(ComboBox5, LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
MsgBox ("Dossier non trouvé")
Exit Sub
Else
If Cells(c.Row, "B").Interior.ColorIndex = xlNone Or Cells(c.Row, "B").Interior.ColorIndex = 2 Then
c.Resize(1, 77).Interior.ColorIndex = sh.[C2].Interior.ColorIndex
Else
c.Resize(1, 77).Interior.ColorIndex = xlNone
End If
End If
End Sub
'COLORIE LA LIGNE EN JAUNE COCHE LA CASE
Private Sub CheckBox12_Click()
Dim sh As Worksheet, c As Range
If ComboBox5 = "" Then
Application.EnableEvents = False
CheckBox12 = False
Application.EnableEvents = False
Exit Sub
End If
Set sh = Worksheets("00-recap")
Set c = sh.[B:B].Find(ComboBox5, LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
MsgBox ("Dossier non trouvé")
Exit Sub
Else
If Cells(c.Row, "B").Interior.ColorIndex = xlNone Or Cells(c.Row, "B").Interior.ColorIndex = 2 Then
c.Resize(1, 77).Interior.ColorIndex = sh.[C3].Interior.ColorIndex
Else
c.Resize(1, 77).Interior.ColorIndex = xlNone
End If
End If
End Sub
'COLORIE LA LIGNE EN BLANC COCHE LA CASE
Private Sub CheckBox13_Click()
Dim sh As Worksheet, c As Range
If ComboBox5 = "" Then
Application.EnableEvents = False
CheckBox13 = False
Application.EnableEvents = False
Exit Sub
End If
Set sh = Worksheets("00-recap")
Set c = sh.[B:B].Find(ComboBox5, LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
MsgBox ("Dossier non trouvé")
Exit Sub
Else
If Cells(c.Row, "B").Interior.ColorIndex = xlNone Or Cells(c.Row, "B").Interior.ColorIndex = 2 Then
c.Resize(1, 77).Interior.ColorIndex = sh.[C4].Interior.ColorIndex
Else
c.Resize(1, 77).Interior.ColorIndex = xlNone
End If
End If
End Sub
Private Sub ComboBox4_Change()
Dim c As Range, sh As Worksheet
Set sh = Worksheets("01-données")
Set c = sh.[B:B].Find(ComboBox4, LookIn:=xlValues, lookat:=xlWhole) 'APPEL DU CODE IMPUTATION SUITE A LA SELECTION DU SITE
TextBoximputation = IIf(c Is Nothing, "", c.Offset(, 1))
End Sub |
Partager