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
| Private Sub BtnRecherche_Click()
Dim ws As Worksheet
Dim rg As Range
Dim i As Integer
Dim ligneOutil As Integer
Dim colonneConcession As Integer
Set ws = Worksheets("Outils")
'Recherche de la ligne de l'outil
Set rg = ws.Range(ws.Range("A14"), ws.Range("A65000").End(xlUp)).Find(ComboNumOutil.Value)
If rg Is Nothing Then
MsgBox "Veuillez choisir un numéro d'outil dans la liste ! "
ComboNumOutil.SetFocus
Exit Sub
End If
ligneOutil = rg.Row
'Recherche de la colonne de la concession
colonneConcession = -1
For i = 11 To 67
If ws.Cells(12, i).Value & ws.Cells(13, i).Value = nomconcess.Value Then
colonneConcession = i
End If
Next i
If colonneConcession = -1 Then
MsgBox "Problème dans la concession choisie"
ComboNumOutil.SetFocus
Exit Sub
End If
Unload Me
With resultatrecherche
.TextNumOutil = ws.Cells(ligneOutil, 1).Value
.TextLibelle = ws.Cells(ligneOutil, 4).Value
.TextEquivalance = ws.Cells(ligneOutil, 3).Value
.TextTaux = ws.Cells(ligneOutil, 5).Value
.TextPrix = ws.Cells(ligneOutil, 8).Value
.TextEmplacement = ws.Cells(ligneOutil, colonneConcession + 1).Value
.TextRemarques = ws.Cells(ligneOutil, colonneConcession + 2).Value
.prealizeslessables = ws.Cells(ligneOutil, 11).Value
.prealizeslaroche = ws.Cells(ligneOutil, 14).Value
.prealizesseat = ws.Cells(ligneOutil, 17).Value
.prechamberyare = ws.Cells(ligneOutil, 20).Value
.prechamberylormont = ws.Cells(ligneOutil, 23).Value
.prechamberyornon = ws.Cells(ligneOutil, 26).Value
.precholletbressuire = ws.Cells(ligneOutil, 29).Value
.precholletparthenay = ws.Cells(ligneOutil, 32).Value
.precouturierfontenay = ws.Cells(ligneOutil, 35).Value
.precouturierlucon = ws.Cells(ligneOutil, 38).Value
.predugastaudi = ws.Cells(ligneOutil, 56).Value
.predugastvu = ws.Cells(ligneOutil, 62).Value
.predugastvw = ws.Cells(ligneOutil, 59).Value
.prehorizon = ws.Cells(ligneOutil, 41).Value
.preouest = ws.Cells(ligneOutil, 44).Value
.prepmbouscat = ws.Cells(ligneOutil, 50).Value
.prepmbuch = ws.Cells(ligneOutil, 47).Value
.prepmmerignac = ws.Cells(ligneOutil, 53).Value
.prevlh = ws.Cells(ligneOutil, 65).Value
.nomconcess2 = ws.Cells(ligneOutil, 69).Value
.Show
End With
End Sub |
Partager