Excel - MODIFICAR Y ELIMINAR UNA FILA SELECCIONANDO UN REGISTRO EN UN LISTBOX

 
Vista:

MODIFICAR Y ELIMINAR UNA FILA SELECCIONANDO UN REGISTRO EN UN LISTBOX

Publicado por JORGE PALACIOS (9 intervenciones) el 07/07/2012 09:37:58
Buenas Noches estoy diseñando un programa en vba de excel 2010, tengo un formulario de creacion de cliente y otro de productos. tengo otro formulario para modifcacar datos y eliminar el formulario trae un listbox que me muestra los datos quisiera poder dar click en un registro especifico y que me de la opcion de modificar los datos o eliminar segun el caso.

este es el codigo de el formulario crear cliente

Private Sub cmdguardarcrearcliente_Click()
Dim razonsocial As String
Dim nit As String
Dim direccion As String
Dim ciudad As String
Dim telefono As String

Dim ultimafila As Double

razonsocial = txtrazonsocial.Value
nit = txtnit.Value
direccion = txtdireccion.Value
ciudad = txtciudad.Value
telefono = txttelefono.Value

ultimafila = ActiveSheet.UsedRange.Row - 1 + ActiveSheet.UsedRange.Rows.Count

Cells(ultimafila + 1, 1) = razonsocial
Cells(ultimafila + 1, 2) = nit
Cells(ultimafila + 1, 3) = direccion
Cells(ultimafila + 1, 4) = ciudad
Cells(ultimafila + 1, 5) = telefono

txtrazonsocial.Value = ""
txtnit.Value = ""
txtdireccion.Value = ""
txtciudad.Value = ""
txttelefono.Value = ""

FRMCREACIONCLIENTE.Hide

ActiveWorkbook.Save

MsgBox ("El cliente ha sido creado.")

End Sub

este es el codigo para el filtro x textbox

Private Sub TextBox1_Change()
Dim i As Integer, Ctrl As Boolean
Ctrl = True
For i = Me.ListBox1.ListCount - 1 To 0 Step -1
If Not IsEmpty(Trim(Me.TextBox1)) Then
If LCase(Me.ListBox1.List(i)) Like LCase(Me.TextBox1.Value) + "*" Then
Me.ListBox1.Selected(i) = True
Ctrl = False
End If
End If
Next
If Ctrl And Not IsEmpty(Trim(Me.TextBox1)) Then
MsgBox "Nombre No Registrado", vbInformation + vbOKOnly, "Sr. Operador"
End If
End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder