Crear Código para Formulario de Entradas en Excel 2003.(Va dirigida a Dante Amor)

Dante buenas noches, por favor necesitaría de ser factible crear el código para el formulario de entrada.-

Muchas gracias

1 respuesta

Respuesta
1

Te anexo el código para las entradas, ya incluye la actualización al stock.

Private Sub ComboBox1_Change()
'Por.Dante Amor
    If ComboBox1 = "" Then
        Label6 = ""
        Exit Sub
    End If
    Label6 = Hoja1.Cells(ComboBox1.ListIndex + 2, "A")
End Sub
Private Sub CommandButton1_Click()
'Por.Dante Amor
    'registra en entradas
    u = Hoja3.Range("A" & Rows.Count).End(xlUp).Row + 1
    Hoja3.Cells(u, "A") = Val(ComboBox1)
    Hoja3.Cells(u, "B") = Date
    Hoja3.Cells(u, "C") = Val(TextBox4)
    'registra en stock
    Set b = Hoja6.Columns("A").Find(Val(Label6))
    If Not b Is Nothing Then
        Hoja6.Cells(b.Row, "B") = Hoja6.Cells(b.Row, "B") + Val(TextBox4)
    Else
        u = Hoja6.Range("A" & Rows.Count).End(xlUp).Row + 1
        Hoja6.Cells(u, "A") = Val(Label6)
        Hoja6.Cells(u, "B") = Val(TextBox4)
    End If
    MsgBox "Entrada realizada con éxito", vbInformation
    ComboBox1 = ""
    Label6 = ""
    TextBox4 = ""
    ComboBox1.SetFocus
End Sub
Private Sub UserForm_Activate()
'Por.Dante Amor
    Label5 = Date
    u = Hoja1.Range("B" & Rows.Count).End(xlUp).Row
    ComboBox1.RowSource = Hoja1.Name & "!B2:B" & u
    ComboBox1.SetFocus
End Sub
Private Sub CommandButton2_Click()
'Por.Dante Amor
    Unload Me
End Sub

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas