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.

incrementar un numero hasta "3"

publicado

Buenas tardes;

Estoy utilizando una macro que encontre aqui para presionar un boton e incrementar (m) el valor de un numero (ubicado en "I") y otro boton para bajarlo (ubicados en  0 , mi pregunta es como puedo hacer para que si el valor de la celda supera el "3" vuelva a 1, espero que me hayan podido entender. Nos se programar en visual pero estoy buscando algo similar a "If value >3; 1 " . Muchas gracias

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

If IsEmpty(Range("I" & ActiveCell.Row).Value) Then GoTo Linea1
If Not Intersect(Target, Range("M" & ActiveCell.Row)) Is Nothing Then Range("I" & ActiveCell.Row).Value = Range("I" & ActiveCell.Row).Value + 1
If Not Intersect(Target, Range("O" & ActiveCell.Row)) Is Nothing Then Range("I" & ActiveCell.Row).Value = Range("I" & ActiveCell.Row).Value - 1
Linea1:
Application.SendKeys ("{ESC}")

End Sub

 

Featured Replies

publicado

Hola.

Prueba con este código:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim iCont As Integer
    With Range("I" & Target.Row)
        iCont = .Value - 1 * ((Target.Column = 13) - (Target.Column = 15))
        .Value = IIf(iCont > 3, 1, IIf(iCont < 1, 3, iCont))
    End With
    Cancel = True
End Sub

Cuando el contador llegue a cero, vuelve a introducir un 3.  Si no quieres que esto ocurra, cambia  " IIF(iCont < 1, 3, iCont)" por "iCont".

Un saludo.

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.