Ver Mensaje Individual
  #9 (permalink)  
Antiguo 07/07/2014, 19:46
JoaoM
 
Fecha de Ingreso: agosto-2007
Mensajes: 1.945
Antigüedad: 16 años, 8 meses
Puntos: 39
Respuesta: validar Edicion en ListBox

Cuando ingreso nuevo cliente estos son los eventos involucrados con el botón

Código:
Private Sub cbtNueClien_Click()
    On Error Resume Next
    Dim fila As Integer
    With Sheets("CLIENTES")
       fila = .Range("b5:b50000").Find(txtRIF, lookat:=xlWhole).Row
       If Err.Number = 91 Then
          fila = .Range("b" & .Rows.Count).End(xlUp)(2).Row
         ' fila = .Range("b5:b50000").Find("").Row
          Call ingresar_datos(fila)
          Exit Sub
       End If
       Call ingresar_datos(fila)
    End With
End Sub

'Inserta y luego ordena alfabeticamente de A hasta G por la columna B
Sub ingresar_datos(fila As Integer, Optional OrdenarPor As String = "B")
    With Sheets("CLIENTES")
        .Cells(fila, 1) = txtRIF
        .Cells(fila, 2) = txtNombre
        .Cells(fila, 3) = txtDirecci
        .Cells(fila, 4) = txtP_Ciud
        .Cells(fila, 5) = txtTelf1
        .Cells(fila, 6) = txtTelf2
        .Cells(fila, 7) = txtFech
        .Range("A2:G" & fila).Sort key1:=.Range(OrdenarPor & fila)
    End With
    Dim tbx As Control
    For Each tbx In Me.Controls
        If TypeName(tbx) = "TextBox" Then tbx = ""
    Next tbx
    Call buscar_Change
    Call actualizar_lista
    txtRIF.SetFocus
End Sub
__________________
Las contraseñas son como la ropa interior: Nunca dejarlas donde la gente pueda verlas
http://i64.tinypic.com/rho40i.jpg