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.

FORMATO CONDICIONAL COMPLICADO

publicado

Buenas noches.

Por favor requiero ayuda para dar formato condicional a una celda de entre 10 celdas, debe ser fondo negro y letra roja. 

(Las celdas tienen ya diferentes colores CON FORMATO CONDICIONAL que configuré con una macro, pero requiero señalar la celda con un color especial que resalte la ubicación. 

La celda a11 indica dónde estará ubicada la CELDA que deberá tener ese formato diferente.

Ejemplo:

a1

6

3

5

0

9

2

8

7

1

4

a11 3

Agradecería la ayuda que se me brinde.

Marco Porras.

PD: Publiqué en dos 

Featured Replies

publicado

a los formatos que ya tengas aplicados (por macro o manuales) agrega una condición más para que el contenido de "la celda" sea igual a lo que pongas en [A11]

publicado
  • Autor

Buena Miguel. se agradece la sugerencia.

Sub CambiarColorFuenteCondicion()
Dim miRango As Range

Set miRango = Range("A1:XFD100")

'
For Each celdaActual In miRango
If celdaActual.Value = "0" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "1" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "2" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "3" Then celdaActual.Font.Color = RGB(0, 0, 0)
If celdaActual.Value = "4" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "5" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "6" Then celdaActual.Font.Color = RGB(0, 0, 0)
If celdaActual.Value = "7" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "8" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "9" Then celdaActual.Font.Color = RGB(0, 0, 0)

If XXXXXXXXXXXXX          Then xxx.Font.Color = RGB(0, 0, 0)

Next
End Sub

No manejo las condicionales con celdas en VB.

Si me dan un ejemplo yo puedo continuar.

saludos marco porras

 

 

 

publicado
Hace 5 horas, MarcoP dijo:

Buena Miguel. se agradece la sugerencia.

Sub CambiarColorFuenteCondicion()
Dim miRango As Range

Set miRango = Range("A1:XFD100")

'
For Each celdaActual In miRango
If celdaActual.Value = "0" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "1" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "2" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "3" Then celdaActual.Font.Color = RGB(0, 0, 0)
If celdaActual.Value = "4" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "5" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "6" Then celdaActual.Font.Color = RGB(0, 0, 0)
If celdaActual.Value = "7" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "8" Then celdaActual.Font.Color = RGB(255, 0, 0)
If celdaActual.Value = "9" Then celdaActual.Font.Color = RGB(0, 0, 0)

If XXXXXXXXXXXXX          Then xxx.Font.Color = RGB(0, 0, 0)

Next
End Sub

No manejo las condicionales con celdas en VB.

Si me dan un ejemplo yo puedo continuar.

saludos marco porras

 

 

 

Marco revisa creo que esto te podría servir:

 

Sub formato()
Dim celda As Object
Dim rng As Range
'con INPUTBOX seleccionamos un rango de celdas
Set rng = Application.InputBox("en que rango quieres aplicar el formato??", Type:=8)

'recorremos cada celda del rango seleccionado
For Each celda In rng
valor = celda.Value
    'asignamos colores según el valor de la celda
    If valor = "LIBRA" Then
    celda.Interior.Color = 65535
    ElseIf valor = "PERMISO" Then
    celda.Interior.Color = 15773696
    ElseIf valor = "GUARDIA" Then
    celda.Interior.Color = 255
    ElseIf valor = "CONSULTA" Then
    celda.Interior.Color = 5296274
    End If
Next celda
End Sub
publicado

Abusando un poco este un ejemplos obra Héctor compartió hace un tiempo, si notas creo que se adaptan a los criterios que buscas aplicar, solo ajustarlo a lo deseado:

Sub Aplicar_FC()

  Dim Color, Cond, n As Byte

  Color = Array(3, 6, 50)

  Cond = Array(">20", ">15", "<=15")

  Range("f2:f24").Select

  With Selection

    With .FormatConditions

      .Delete

      For n = 1 To 3

        .Add Type:=xlExpression, Formula1:="=$h$1-f2" & Cond(n)

        With .Parent.FormatConditions(n)

          .Font.Bold = True

          .Interior.ColorIndex = Color(n)

        End With

      Next

    End With

  End With

End Sub

 

publicado

prueba esta macro

Sub colorear_fuente_condicionado()
Set miRango = Range("a1").CurrentRegion

With miRango
    filas = .Rows.Count
    For i = 1 To filas
        numero = .Cells(i, 1)
        Select Case numero
        Case 0, 1, 2, 4, 5, 7, 8
        .Cells(i, 1).Font.ColorIndex = 3
        End Select
    Next i
    .Cells(filas, 1).Interior.ColorIndex = 1
    .Cells(filas, 1).Font.ColorIndex = 3
End With
Set miRango = Nothing
End Sub

 

publicado
  • Autor

Buenas foristas.

Hago mis primeras armas en este nivel de macros.

Me queda grande la tarea. Adjunto archivo por si pueden ayudar.

Gracias. 

MUESTRA PARA FORO.xlsm

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.