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.

Repetir datos en otras columnas

publicado
Buenas tardes,
 
Tengo este fragmento de código en el libro, de manera que cada vez que introduzco un valor en una celda de la columna B, me devuelve la fecha en la celda adyacente de la columna C. Me gustaría repetir la misma operación en el mismo libro, de manera que cuando se introduce un valor en las celdas de las columnas E y H, también devuelva las fechas en las celdas adyacentes de las columnas F e I. ¿Alguien sabría indicarme cómo repetir la misma operación?
 

Private Sub Worksheet_Change(ByVal Target As Range)
tiempo = Date
Set isect = Application.Intersect(Target, Range("B:B"))
If Not isect Is Nothing Then
If isect.Value <> "" Then
isect.Offset(0, 1).Value = tiempo
End If
Set isect = Application.Intersect(Target, Range("B:B"))
If Not isect Is Nothing Then
If isect.Value = "" Then
isect.Offset(0, 1).Value = ""
End If
End If
End If
End Sub

Private Sub Worksheet_Deactivate()

End Sub
 

Sin título.jpg

Featured Replies

publicado
  • Autor

Buenas tardes,

Supongo que repitiendo el mismo fragmento de código pero modificando las letras de las columnas, obtendría el mismo resultado:

----------

Private Sub Worksheet_Change(ByVal Target As Range)
tiempo = Date
Set isect = Application.Intersect(Target, Range("B:B"))
If Not isect Is Nothing Then
    If isect.Value <> "" Then
        isect.Offset(0, 1).Value = tiempo
    End If
    Set isect = Application.Intersect(Target, Range("B:B"))
    If Not isect Is Nothing Then
        If isect.Value = "" Then
            isect.Offset(0, 1).Value = ""
        End If
    End If
End If

Set isect = Application.Intersect(Target, Range("E:E"))
If Not isect Is Nothing Then
    If isect.Value <> "" Then
        isect.Offset(0, 1).Value = tiempo
    End If
    Set isect = Application.Intersect(Target, Range("E:E"))
    If Not isect Is Nothing Then
        If isect.Value = "" Then
            isect.Offset(0, 1).Value = ""
        End If
    End If
End If

Set isect = Application.Intersect(Target, Range("H:H"))
If Not isect Is Nothing Then
    If isect.Value <> "" Then
        isect.Offset(0, 1).Value = tiempo
    End If
    Set isect = Application.Intersect(Target, Range("H:H"))
    If Not isect Is Nothing Then
        If isect.Value = "" Then
            isect.Offset(0, 1).Value = ""
        End If
    End If
End If

End Sub

Private Sub Worksheet_Deactivate()

End Sub

----------

¿Sería correcto?

 

publicado

Buenas @Mohamad Marrawi Marrawi , seria de esta forma :

Private Sub Worksheet_Change(ByVal Target As Range)
 If Not Intersect(Target, Range("B:B,E:E,H:H")) Is Nothing And InStr(1, Target.Address, ":") = 0 Then
  If Target <> Empty Then
   Target.Offset(0, 1).Value = Date
  Else
   Target.Offset(0, 1).Value = ""
  End If
 End If
End Sub

Saludos

 

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.