Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

error código de modificar

publicado

hola excelente aportes para comenzar, necesito su ayuda por favor, cree formulario active x  para que se poder hacer ingresos y modificación de datos todo iba bien hasta que puse el botón de modificar y metí el código pero ahora me sale un error que ejecución 424 espera un parámetro. No se que hice mal pongo el código del botón y no me deja ejecutarlo y ya he tratado pero nada,  bueno adicional a esto me gustaría que cuando se meta la información conserve los formatos de las celdas mil gracias.

dejo el código.

Private Sub buscar_Click()
On Error Resume Next
nombre.Value = WorksheetFunction.VLookup(Val(id.Value), Sheets(1).Range("A5:D400"), 2, False)
cc.Value = WorksheetFunction.VLookup(Val(id.Value), Sheets(1).Range("A5:D400"), 3, False)
fecha.Value = WorksheetFunction.VLookup(Val(id.Value), Sheets(1).Range("A5:D400"), 4, False)
End Sub

Private Sub CANCELAR_Click()

Unload Me

End Sub

Private Sub id_Change()

If Val(id.Value) = 0 Then
 buscar.Enabled = True
 ingreso.Enabled = False
 modifica.Enabled = True
End If

End Sub

Private Sub ingreso_Click()

With Sheets("CLIENTES-VS")

.Rows("5:5").Insert Shift:=xlDown
   
.Rows("5:5").Interior.Pattern = xlNone

.Range("A5").Value = id

.Range("B5").Value = nombre

.Range("C5").Value = cc

.Range("D5").Value = fecha

End With

End Sub

Private Sub modifica_Click()

bus_id = WorksheetFunction.Match(Val(id.Value), Sheets(1).Range("A5:A400"), 0) + 4
    With Sheets("CLIENTES-VS")
    
        .Range("B" & bus_id).Value = nombre.Value
   
        .Range("C" & bus_id).Value = cc.Value
 
        .Range("d" & bus_id).Value = fecha.Value
    End With
End Sub

Private Sub UserForm_Initialize()

 buscar.Enabled = False
  ingresar.Enabled = True
  modifica.Enabled = False
id.Value = Range("f2").Value + 1

End Sub
 

 

Featured Replies

publicado

@jhonja , al menos debías haber dicho en qué línea te da el error, ya que no has subido tu archivo para poder depurar el código :mellow:

Mirando tu código me imagino que es por esta línea

bus_id = WorksheetFunction.Match(Val(id.Value), Sheets(1).Range("A5:A400"), 0) + 4

Estás usando una variable (id.Value) que no tienes definido en el código de "Modificar", si no en un procedimiento anterior y al abrir el form.

Prueba a definirlo en el mismo procedimiento
 

Private Sub modifica_Click()

id.Value = Range("f2").Value + 1

bus_id = WorksheetFunction.Match(Val(id.Value), Sheets(1).Range("A5:A400"), 0) + 4
    With Sheets("CLIENTES-VS")   
        .Range("B" & bus_id).Value = nombre.Value  
        .Range("C" & bus_id).Value = cc.Value
        .Range("d" & bus_id).Value = fecha.Value
    End With
End Sub

 

publicado

varias cosas @jhonja

En esta rutina:

Private Sub UserForm_Initialize()

 buscar.Enabled = False
  ingresar.Enabled = True
  modifica.Enabled = False
id.Value = Range("f2").Value + 1

End Sub

El textbox no se llama "ingresar", si no "ingreso". Si no lo modificas te dará error al intentar abrir el form

ingreso.Enabled=True

En la siguiente línea de código, al menos en la que me has pasado, haces referencia a Sheets(2)... que no existe :huh:

bus_id = WorksheetFunction.Match(Val(id.Value), Sheets(1).Range("A5:A400"), 0) + 4

Así que no sé si la tienes que modificar o no, pero asegurate que busque en la hoja correcta. Aparte, activas el botón de modificar si id=0... pero al intentar modificar cuando id=0, si no TIENES ningún valor 0 en la columna A siempre te va a dar error, porque no pùede encontrar nada

:blink:

 

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.