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.

Revisión de código

publicado

Soy nuevo utilizando VBA y buscando en los foros logré crear una Macro para mostrar algunos resultados.

Supongo que necesitan saber qué hace pero no sé como explicarlo! ?

Tengo dos hojas una de nombre Ticket y otra con nombre Hoja1

En ticket debe mostrar la fecha actual en la celda C3 , la Hora actual en la celda D3 y un numero (serie) que aumenta en 1 según el valor de la celda D2 de la hoja1

esta información se guarda como valores en la fila 2 de la Hoja1.

Luego ingresando el número de serie en la celda B9 de la hoja Ticket, lo busca y muestra la Hora (guardada anteriormente) en la celda C9, resta la fecha actual (Now) con la celda C9 y lo muestra en formato de hora. Luego multiplica este valor por 24 y por 10 (para obtener el valor a cobrar).

Creo que es todo... les agrego el código para que puedan ayudarme corrigiendo y si fuera posible, explicando todos los errores que cometí al unir las macros. Mi deseo es aprender a usar esta herramienta.

Private Sub Worksheet_Change(ByVal Target As Range)
    
    On Error Resume Next
    If Target.Address = "$B$3" And Range("B3") > "0" Then
    
       Range("C3", "D3").Value = Now
       Range("E3").Value = Sheets("Hoja1").Range("D2").Value + 1
       
    End If
    
        Dim c As Range
        Set c = Sheets("Hoja1").Range("D:D").Find(Sheets("Ticket").Range("B9"), LookAt:=xlWhole, LookIn:=xlValues)
        
    If Target.Address = "$B$9" And Range("$B$9") > "0" Then
    
       Range("C9").Value = Sheets("Hoja1").Range(c.Address()).Offset(0, -1).Value
       Range("D9").Value = Now - Range("C9").Value
       Range("E9").Value = Format((Sheets("Ticket").Range("D9").Value * 24) * 10, "#,##0.00")
        
    End If

    If Target.Address = "$B$9" And Range("B9") > "0" Then
    
       Range("D9").Value = FormatDateTime(Range("D9"), vbShortTime)

    End If
    
        
End Sub

Featured Replies

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.