Voir la boîte cod textbox1
C'est la même idée dans la colonne Cheet2
Private Sub TextBox1_Change()
If Me.ComboBox4.Value = "" Then MsgBox "Veuillez d'abord saisir le type de mouvement": Exit Sub
TextBox85 = ""
TextBox4 = ""
'Me.TextBox6.Enabled = False
Dim iii
Dim ws As Worksheet, Rng As Range, Sel As Variant
Set ws = Sheets("Sheet2")
Sel = Me.TextBox1.Value
If Sel <> "" Then
Set Rng = ws.Columns(2).Find(Sel, lookat:=xlWhole)
If Not Rng Is Nothing Then
Me.TextBox1.Value = ws.Cells(Rng.Row, "b")
Me.TextBox2.Value = ws.Cells(Rng.Row, "c")
Me.TextBox3.Value = ws.Cells(Rng.Row, "d")
Me.TextBox4.Value = ws.Cells(Rng.Row, "h")
Me.TextBox89.Value = WorksheetFunction.SumIfs(ws.Range("f:f"), ws.Range("b:b"), Me.TextBox1, ws.Range("s:s"), Me.ComboBox4, ws.Range("p
"), Me.ComboBox6)
Me.TextBox12.Value = WorksheetFunction.SumIfs(ws.Range("f:f"), ws.Range("b:b"), Me.TextBox1, ws.Range("s:s"), Me.ComboBox4, ws.Range("p
"), Me.ComboBox6)
Me.TextBox12 = Val(Me.TextBox89.Value) - Val(Me.TextBox12.Value) '- Val(Me.TextBox82.Value)
End If
End If
Sheet3.Activate
iii = 2
Do Until Sheet3.Cells(iii, "g").Text = ""
If Me.TextBox1.Text = Sheet3.Cells(iii, "g").Text Then
Cells(iii, "g").Activate
Me.TextBox2 = ActiveCell.Offset(0, 1).Text
Me.TextBox3 = ActiveCell.Offset(0, 2).Text
Me.TextBox4 = ActiveCell.Offset(0, 3).Text
Exit Sub
Else
End If
iii = iii + 1
'TextBox58.SetFocus
Loop
'Me.TextBox6.Enabled = False
'TextBox12.BackColor = &H80FFFF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'ComboBox1 = ""
'TextBox2 = ""
'TextBox3 = ""
'TextBox4 = ""
'TextBox5 = ""
'Dim i As Long
'Dim dsrc As Range
'Set dsrc = searchs()
'If Not dsrc Is Nothing Then
'i = dsrc.Row
'Me.ComboBox1.Value = Cells(i, 7).Value
'Me.TextBox2.Value = Cells(i, 8).Value
'Me.TextBox3.Value = Cells(i, 9).Value
''Me.TextBox4.Value = Cells(i, 10).Value
'Else
'End If
'ComboBox1.Enabled = False
'ComboBox1 = ""
'ComboBox2 = ""
'ComboBox3 = ""
'ComboBox4 = ""
'ComboBox5 = ""
'TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
'TextBox6 = ""
'TextBox7 = ""
TextBox8 = ""
TextBox9 = ""
Me.TextBox12.Enabled = False
Me.NoCommande.Enabled = False
TextBox12.BackColor = &H80FFFF
End Sub
En bref, je veux montrer la quantité d'inventaire dans le textbox12 code, le type de magasin ou le fournisseur