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.

reducir codigo para resaltar celdas de una hoja a otra con condicion

publicado

como puedo mejorar este codigo byfejoal  para que realice la condicion de resaltar las celdas azules que estan cerca a la celda de borde a una distancia de 21 celdas anterior y porterior a la celda de borde

el codigo realiza ese proceso pero me gustaria que el codigo fuera un poco mas reducido y ademas tengo problema con esta linea del codigo sub color

Sub color()
Worksheets("hoja2").Range("b2:ac33").Interior.color = xlNone
Set ha = Worksheets("hoja2").Range("b2:ac33")
Set hn = Worksheets("hoja1").Range("a1:cy42")     'controlar rango
For i = 1 To hn.Cells.Count
    'si la columna es par se omite
    If hn.Cells(i).Column Mod 2 = 0 Then GoTo SALIDA
    numero = hn.Cells(i)
    cuenta = WorksheetFunction.CountIf(ha, numero)
    If cuenta > 0 Then
        For j = 1 To cuenta
            If j = 1 Then Set busca = ha.Find(numero)
            If j > 1 Then Set busca = ha.FindNext(busca)
            On Error Resume Next   'si no se encuentra busca se omite el error
            Celda = busca.Address
            If Worksheets("hoja2").Range(Celda).Interior.ColorIndex = xlNone Then
                Worksheets("hoja2").Range(Celda).Interior.ColorIndex = 6
            End If
        Next j
    End If
SALIDA:
Next i

End Sub
les agradezco la colaboracion si alguien me puede ayudar a resolverlo

 

BuscarHoja2.xlsm

Featured Replies

publicado

Worksheets("hoja2").Range("b2:ac33").Interior.ColorIndex = xlNone

publicado
  • Autor

maestro antoni entendi mi error pero habra alguna otra forma de expresar esa misma linea de codigo 

publicado
  • Autor

y lo mismo con el codigo byfejoal del libro que envie como puedo modificarlo o reducirlo y ademas me da error en esta linea

.celda1.interior.color =colormarca

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.