No me guarda los datos de una parte del formulario vba
Dentro de mi código mando información a tres hojas diferentes en al hoja 8 y 9 todo se graba sin problemas pero en la hoja 3 no graba ningún dato.
Espero puedan ayudarme
Private Sub btn_Procesar_Click()
Dim Fila As Integer
Dim Existencia As Integer
Dim altas As Integer
With frm_parte
Hoja4.Range("h1").Value = Hoja4.Range("h1").Value + 1
Comprb = Hoja4.Range("h1").Value
If cbo_not.Text = Empty Or _
txt_fecha.Text = Empty Or _
eje1.Text = Empty Or _
eje2.Text = Empty Or _
ListBox1.ListCount = 0 Or _
ListBox2.ListCount = 0 Then
MsgBox "Hay cambios vacios en el PARTE"""
Exit Sub
End If
If txt_fecha = "" Then
MsgBox "Captura la fecha"
txt_fecha.SetFocus
Exit Sub
End If
final = Hoja8.Range("A" & Rows.Count).End(3).Row + 1
For i = 1 To 3
Hoja8.Cells(final, 1) = "P" & Comprb
Hoja8.Cells(final, 2) = Me.txt_fecha
Hoja8.Cells(final, 3) = Me.cbo_not
Hoja8.Cells(final, 4) = Me.txt_equipo
Hoja8.Cells(final, 5) = Me.txt_descrip
Hoja8.Cells(final, 6) = Me.Controls("eje" & i)
final = final + 1
Next
final = Hoja9.Range("A" & Rows.Count).End(xlUp).Row
For i = 0 To ListBox1.ListCount - 1
Hoja9.Cells(final, 6) = ListBox1.List(i, 0)
Hoja9.Cells(final, 7) = ListBox1.List(i, 1)
Hoja9.Cells(final, 8) = ListBox1.List(i, 2)
Hoja9.Cells(final, 1) = "P" & Comprb
Hoja9.Cells(final, 2) = txt_fecha.Text
Hoja9.Cells(final, 3) = cbo_not
Hoja9.Cells(final, 4) = txt_equipo
Hoja9.Cells(final, 5) = txt_descrip
final = final + 1
Next i
final = Hoja3.Range("A" & Rows.Count).End(xlUp).Row
For i = 0 To ListBox2.ListCount - 1
Hoja3.Cells(final, 6) = ListBox2.List(i, 0)
Hoja3.Cells(final, 7) = ListBox2.List(i, 1)
Hoja3.Cells(final, 1) = "P" & Comprb
Hoja3.Cells(final, 2) = txt_fecha.Text
Hoja3.Cells(final, 3) = cbo_not
Hoja3.Cells(final, 4) = txt_equipo
Hoja3.Cells(final, 5) = txt_descrip
finali = finali + 1
Next i
End With
'i = 0
'Imprimirparte
Me.cbo_not.SetFocus
Unload Me
frm_parte.Show
End Sub
1 Respuesta
Respuesta de Dante Amor
2
