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.

Dudas sobre como colorear la celda anterior a la celda que almacena el nuevo dato

publicado

Hola!!

Conformo que  soy nueva en esto de macros. He hecho un formulario investigando aqui y alla, el cual agrega y modifica datos y los almacena en otra hoja

del mismo libro.

Hasta ahi mi formulario funciona como lo deseo, pero al querer modificar o agregar un dato faltante aun registrom quiero que la celda anterior a la celda a la cual agrego el nuevo dato, 

cambie el color de fondo.

Investigando di con el evento worksheet_change(ByVal Target As range)

el caso es que si hace el cambio de color de fondo, pero no queda permanente.

Dejo el codigo que use y les suplico ayuda

 

rivate Sub Worksheet_Change(ByVal Target As Range)
'Application.EnableEvents = False
'On Error GoTo Error

    Dim c As Range

    If Not Application.Intersect(Target, Range("I5:I400")) Is Nothing Then
            For Each c In Range("H5:H400")
                If c.Value = Date Then
              c.Interior.ColorIndex = 40
               ' Else
              ' c.Interior.ColorIndex = xlColorIndexNone
                End If
            Next
  End If
  
  If Not Application.Intersect(Target, Range("J5:J400")) Is Nothing Then
            For Each c In Range("I5:I400")
                If c.Value = Date Then
              c.Interior.ColorIndex = 40
                'Else
               'c.Interior.ColorIndex = xlColorIndexNone
                  '  c.EntireRow.Hidden = True
               ' ElseIf c.Value = "#show#" Then
                    'c.EntireRow.Hidden = False
                End If
            Next
  End If
  
  If Not Application.Intersect(Target, Range("K5:K400")) Is Nothing Then
            For Each c In Range("J5:J400")
                If c.Value = Date Then
              c.Interior.ColorIndex = 40
                Else
               c.Interior.ColorIndex = xlColorIndexNone
                End If
            Next
  End If
  
  If Not Application.Intersect(Target, Range("L5:L400")) Is Nothing Then
            For Each c In Range("K5:K400")
                If c.Value = Date Then
              c.Interior.ColorIndex = 40
                Else
               c.Interior.ColorIndex = xlColorIndexNone
                End If
            Next
  End If
  
  If Not Application.Intersect(Target, Range("M5:M400")) Is Nothing Then
            For Each c In Range("L5:L400")
                If c.Value = Date Then
              c.Interior.ColorIndex = 40
                Else
               c.Interior.ColorIndex = xlColorIndexNone
                End If
            Next
  End If
  
  If Not Application.Intersect(Target, Range("N5:N400")) Is Nothing Then
            For Each c In Range("M5:M400")
                If c.Value = Date Then
              c.Interior.ColorIndex = 40
                Else
               c.Interior.ColorIndex = xlColorIndexNone
                End If
            Next
  End If
  
  If Not Application.Intersect(Target, Range("P5:P400")) Is Nothing Then
            For Each c In Range("N5:N400")
                If c.Value = Date Then
              c.Interior.ColorIndex = 40
                Else
               c.Interior.ColorIndex = xlColorIndexNone
                End If
            Next
  End If
  
  'If Not Application.Intersect(Target, Range("P5:P400")) Is Nothing Then
            'For Each c In Range("P5:P400")
               ' If Range.Value = Date Then
             ' Range.Interior.ColorIndex = 35
               ' Else
              ' c.Interior.ColorIndex = xlColorIndexNone
               ' End If
           ' Next
  'End If
'Error:
'Application.EnableEvents = True
End Sub
'If .Range("I5").Value = DateValue(Date) Then
                    '.Range("H5").Interior.ColorIndex = 40
                     '  Else
                     '   .Range("H5").Interior.ColorIndex = xlNone
               ' End If
                
               ' If .Range("J5").Value = Date Then
                 '   Sheets("Record").Range("I5").Interior.ColorIndex = 40
                      '  Else
                      '  .Range("I5").Interior.ColorIndex = xlNone
                       ' End If
 

 

Featured Replies

publicado

Sube un archivo con un ejemplo de lo que pretendes hacer, ya que con la macro solo podemos comprobar que no hace lo que quieres.

  • Silvia bloqueó este tema

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.