0% found this document useful (0 votes)
33 views

Codigo de Control Original

Uploaded by

Kain D. Belmont
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Codigo de Control Original

Uploaded by

Kain D. Belmont
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

rivate Sub UserForm_Initialize()

Application.Visible = False

End Sub

Private Sub CommandButton1_Click()

End Sub

Private Sub BT_Agreagar_Click()

uso.Height = 685.5
Me.TextCodigo.SetFocus

Lista.ListIndex = -1

ID = Sheets("laugth").Range("c4")
Me.TextID = ID

Me.TextCodigo.Value = Empty
Me.TextDescripcion.Value = Empty
Me.TextCantidad.Value = Empty
Me.TextMotivo.Value = Empty
Me.TextFecha.Value = Empty
Me.TextFolio.Value = Empty
Me.TextRetorno.Value = Empty

Me.BT_ModificarDos.Enabled = False
Me.BT_EliminarDos.Enabled = False
Me.BT_Modificar.Enabled = False
Me.BT_Eliminar.Enabled = False

Me.BT_Agreagar.Enabled = True
Me.BT_AgregarDos.Enabled = True

End Sub

Private Sub BT_AgregarDos_Click()

Sheets("laugth").Range("C6").EntireRow.Insert

Range("C6").Value = Me.TextID.Value
Range("D6").Value = Me.TextCodigo.Value
Range("E6").Value = Me.TextDescripcion.Value
Range("F6").Value = Me.TextCantidad.Value
Range("G6").Value = Me.TextMotivo.Value
Range("H6").Value = Me.TextFecha.Value
Range("I6").Value = Me.TextFolio.Value
Range("J6").Value = Me.TextRetorno.Value

Me.Lista.RowSource = "ENTRADAS"
Me.Lista.ColumnCount = 8

Me.TextID.Value = Empty
Me.TextCodigo.Value = Empty
Me.TextDescripcion.Value = Empty
Me.TextCantidad.Value = Empty
Me.TextMotivo.Value = Empty
Me.TextFecha.Value = Empty
Me.TextFecha.Value = Empty
Me.TextRetorno.Value = Empty

ID = Sheets("laugth").Range("C4")

Me.TextID = ID

Me.TextCodigo.SetFocus

uso.Height = 496.5

Me.BT_Modificar.Enabled = True
Me.BT_Eliminar.Enabled = True
Me.BT_ModificarDos.Enabled = True
Me.BT_EliminarDos.Enabled = True

End Sub

Private Sub BT_Buscar_Click()

If Me.TextBuscar = "" Then

MsgBox "Por Favor Ingrese el Dato a Buscar"


Me.TextBuscar.SetFocus

Exit Sub
End If

Me.Lista.RowSource = Clear

ULFILA = Sheets("laugth").Range("C" & Rows.Count).End(xlUp).Row

For FILA = 6 To ULFILA

If UCase(Cells(FILA, 4).Value) Like "*" & UCase(Me.TextBuscar.Value) & "*" Then

Me.Lista.AddItem Cells(FILA, 1)

Me.Lista.List(Lista.ListCount - 1, 0) = Cells(FILA, 3)
Me.Lista.List(Lista.ListCount - 1, 1) = Cells(FILA, 4)
Me.Lista.List(Lista.ListCount - 1, 2) = Cells(FILA, 5)
Me.Lista.List(Lista.ListCount - 1, 3) = Cells(FILA, 6)
Me.Lista.List(Lista.ListCount - 1, 4) = Cells(FILA, 7)
Me.Lista.List(Lista.ListCount - 1, 5) = Cells(FILA, 8)
Me.Lista.List(Lista.ListCount - 1, 6) = Cells(FILA, 9)
Me.Lista.List(Lista.ListCount - 1, 7) = Cells(FILA, 10)

End If

Next FILA

Me.TextBuscar = Empty

Me.TextBuscar.SetFocus

End Sub
Private Sub BT_Eliminar_Click()

If Lista.ListIndex = -1 Then

MsgBox "Seleccione un Dato a Eliminar"

Else

uso.Height = 685.5

Me.BT_AgregarDos.Enabled = False
Me.BT_ModificarDos.Enabled = False
Me.BT_Agreagar.Enabled = False
Me.BT_Modificar.Enabled = False

Me.BT_Eliminar.Enabled = True
Me.BT_EliminarDos.Enabled = True

End If

End Sub

Private Sub BT_EliminarDos_Click()

Dim FILA As Object


Dim LINEA As Integer

ValorBuscado = Me.TextID

Set FILA = Sheets("laugth").Range("C:C").Find(ValorBuscado, Lookat:=xlWhole)

LINEA = FILA.Row

Range("C" & LINEA).EntireRow.Delete

uso.Height = 496.5

Me.Lista.RowSource = "ENTRADAS"
Me.Lista.ColumnCount = 8

Me.BT_AgregarDos.Enabled = False
Me.BT_ModificarDos.Enabled = False
Me.BT_Agreagar.Enabled = True
Me.BT_Modificar.Enabled = False

Lista.ListIndex = -1

End Sub

Private Sub BT_Modificar_Click()

If Me.Lista.ListIndex = -1 Then

MsgBox "Seleccione el Dato a Modificar"

Else
uso.Height = 685.5
Me.BT_AgregarDos.Enabled = False
Me.BT_EliminarDos.Enabled = False
Me.BT_Agreagar.Enabled = False
Me.BT_Eliminar.Enabled = False

Me.BT_Modificar.Enabled = True
Me.BT_ModificarDos.Enabled = True

End If

End Sub

Private Sub BT_ModificarDos_Click()

Dim FILA As Object


Dim LINEA As String

ValorBuscado = Me.TextID

Set FILA = Sheets("laugth").Range("C:C").Find(ValorBuscado, Lookat:=xlWhole)

LINEA = FILA.Row

Range("D" & LINEA).Value = Me.TextCodigo.Value


Range("E" & LINEA).Value = Me.TextDescripcion.Value
Range("F" & LINEA).Value = Me.TextCantidad.Value
Range("G" & LINEA).Value = Me.TextMotivo.Value
Range("H" & LINEA).Value = Me.TextFecha.Value
Range("I" & LINEA).Value = Me.TextFolio.Value
Range("J" & LINEA).Value = Me.TextRetorno.Value

uso.Height = 496.5

Me.Lista.RowSource = "ENTRADAS"
Me.Lista.ColumnCount = 8

Me.BT_Agreagar.Enabled = True
Me.BT_Eliminar.Enabled = True
Me.BT_AgregarDos.Enabled = True
Me.BT_EliminarDos.Enabled = True

Lista.ListIndex = -1

End Sub

Private Sub CommandButton5_Click()

Unload Me
Application.Visible = True

End Sub

Private Sub CommandButton6_Click()

uso.Height = 496.5

Me.BT_Agreagar.Enabled = True
Me.BT_AgregarDos.Enabled = True
Me.BT_Modificar.Enabled = True
Me.BT_ModificarDos.Enabled = True
Me.BT_Eliminar.Enabled = True
Me.BT_EliminarDos.Enabled = True

Lista.ListIndex = -1

End Sub

Private Sub CommandButton7_Click()

ActiveWorkbook.Save

End Sub

Private Sub Lista_Click()

Dim ID As Integer

ID = Lista.List(Lista.ListIndex, 0)

Me.TextID = ID

End Sub

Private Sub TextID_Change()

On Error Resume Next

Dim ID As Integer

ID = TextID.Value

Me.TextCodigo = Application.WorksheetFunction.VLookup(ID,
Sheets("laugth").Range("C:J"), 2, 0)
Me.TextDescripcion = Application.WorksheetFunction.VLookup(ID,
Sheets("laugth").Range("C:J"), 3, 0)
Me.TextCantidad = Application.WorksheetFunction.VLookup(ID,
Sheets("laugth").Range("C:J"), 4, 0)
Me.TextMotivo = Application.WorksheetFunction.VLookup(ID,
Sheets("laugth").Range("C:J"), 5, 0)
Me.TextFecha = Application.WorksheetFunction.VLookup(ID,
Sheets("laugth").Range("C:J"), 6, 0)
Me.TextFolio = Application.WorksheetFunction.VLookup(ID,
Sheets("laugth").Range("C:J"), 7, 0)
Me.TextRetorno = Application.WorksheetFunction.VLookup(ID,
Sheets("laugth").Range("C:J"), 8, 0)

End Sub

Private Sub UserForm_Activate()

Dim ID As String

ID = Sheets("laugth").Range("C4")

Me.TextID = ID
Me.Lista.RowSource = "ENTRADAS"
Me.Lista.ColumnCount = 8

uso.Height = 496.5

Me.Lista.ColumnHeads = True

End Sub

You might also like