Vincular dos combobox y un textbox después del segundo combo box
Antemano aclara soy principiante. Tengo un problema tengo dos combobox (codigos de productos) vinculados el primero del segundo y por otro lado tengo otro combobox ( dodigos de producto) vinculado con otros textbox (descripción del producto), Las dos funciones me trabajan separadas pero cuando las trato de unir me saltan errores.
Código de los dos combobox
Private Sub ComboBox1_Change()
ComboBox6.Clear
Sheets("Codigos").Select
columna1 = ComboBox1.ListIndex + 1
Cells(2, columna1).Select
ultimaFila = Columns("A:A").Range("A100000").End(xlUp).Row
For cont = 2 To ultimaFila
If Cells(cont, columna1) <> "" Then
ComboBox6.AddItem (Cells(cont, columna1))
End If
Next
Sheets("Inicio").Select
End Sub
Private Sub UserForm_Activate()
Sheets("Partida").Select
ultimaFila = Columns("A:A").Range("A100000").End(xlUp).Row
For cont = 2 To ultimaFila
If Cells(cont, 1) <> "" Then
ComboBox1.AddItem (Cells(cont, 1))
End If
Next
Sheets("Inicio").Selec
CODIGO DEL COMBOBOX VINCULADO AL TEXTBOX
Private Sub ComboBox1_Change()
Dim Fila As Integer
Dim Final As Integer
If ComboBox1.Value = "" Then
Me.txt_Nombre = ""
Me.txt_Saldo = ""
End If
For Fila = 2 To 10000
If Hoja2.Cells(Fila, 1) = "" And Hoja5.Cells(Fila, 1) = "" Then
Final = Fila - 1
Exit For
End If
Next
For Fila = 2 To Final
If ComboBox1 = Hoja2.Cells(Fila, 1) Then
Me.txt_Nombre = Hoja2.Cells(Fila, 2)
Exit For
End If
Next
For Fila = 2 To Final
If ComboBox1 = Hoja5.Cells(Fila, 1) Then
Me.txt_Saldo = Hoja5.Cells(Fila, 3)
Exit For
End If
Next
End Sub
Private Sub ComboBox1_Enter()
Dim Fila As Integer
Dim Final As Integer
Dim Lista As String
For Fila = 1 To ComboBox1.ListCount
ComboBox1.RemoveItem 0
Next Fila
For Fila = 2 To 10000
If Hoja2.Cells(Fila, 1) = "" Then
Final = Fila - 1
Exit For
End If
Next
For Fila = 2 To Final
Lista = Hoja2.Cells(Fila, 1)
ComboBox1.AddItem (Lista)
Next
End Sub
Private Sub CommandButton1_Click()
Dim Fila As Integer
Dim Final As Integer
Dim Existencia As Integer
Dim Total As Integer
For Fila = 2 To 10000
If Hoja3.Cells(Fila, 1) = "" Then
Final = Fila
Exit For
End If
Next
Hoja3.Cells(Final, 1) = Me.ComboBox1
Hoja3.Cells(Final, 2) = Me.txt_Nombre
Hoja3.Cells(Final, 3) = Me.txt_FechaIng
Hoja3.Cells(Final, 4) = Me.txt_Factura
Hoja3.Cells(Final, 5) = Me.txt_Proveedor
Hoja3.Cells(Final, 6) = Me.txt_Cantidad
For Fila = 2 To 10000
If Hoja5.Cells(Fila, 1) = Hoja3.Cells(Final, 1) Then
Existencia = Hoja5.Cells(Fila, 3)
Total = Me.txt_Cantidad + Existencia
Hoja5.Cells(Fila, 3) = Total
Exit For
End If
Next
Me.ComboBox1 = ""
Me.txt_Nombre = ""
Me.txt_FechaIng = ""
Me.txt_Factura = ""
Me.txt_Proveedor = ""
Me.txt_Cantidad = ""
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub