Private OD As Worksheet
Private TV As Variant
Private NL As Integer
Private Sub UserForm_Initialize()
Me.lblfch = Date
With ListBox1
.ColumnCount = 10
.ColumnWidths = "60 pt;60 pt;40 pt;185 pt;30 pt;40 pt ;50 pt ;50pt ;50pt ;50pt"
End With
Set OD = Worksheets("DEVIS")
TV = OD.Range("A1").CurrentRegion
NL = UBound(TV, 1)
End Sub
Private Sub TextBox1_Change()
Dim Total As Double
OD.Visible = True
OD.Activate
Me.ListBox1.Clear
If Me.TextBox1.Value = "" Then Exit Sub
For I = 2 To NL
If InStr(1, OD.Cells(I, 2), Me.TextBox1.Value, vbTextCompare) > 0 Then
With Me.ListBox1
.AddItem
For J = 1 To 10
.Column(J - 1, .ListCount - 1) = OD.Cells(I, J)
If J = 6 Then Total = Total + .Column(J - 1, .ListCount - 1)
Next J
End With
End If
Next I
TextBox2.Value = Me.ListBox1.ListCount
Me.TextBox3 = Total
End Sub