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.

Borrar formato de celdas y dar nuevo formato

publicado

Hola buenas tardes.

Tengo una plantilla en la que doy formato de texto a mis celdas en base a condiciones dentro de la columna A con una macro.

ejemplo si en A20 tengo "SI" la celda G20 se pone en azul y negrita y así diferentes condicionantes.

Pero al ser mi plantilla este se reutiliza.

en ocasiones estas celdas ya tienen un formato previo, necesito que antes de ejecutar un nuevo formato me limpie o borre  el formato y dar el nuevo. y así con las celdas que aplican a las condiciones puestas.Cambio de formatos.xlsm

Muchas gracias

Mariano

Featured Replies

publicado

Te dejo dos opciones  primera: 

Cambia tu macro por esta modificas las celdas de la columna a y ejecutas la macro

Sub Poneformat()
    Application.ScreenUpdating = False
    With Sheets("Plantilla")
        For i = 17 To .Range("A" & Rows.Count).End(xlUp).Row
            .Cells(i, "G").ClearFormats
            
            Select Case .Cells(i, "A")
                Case "SI"
                    .Cells(i, "G").Font.Color = RGB(1, 70, 99)
                    .Cells(i, "G").Font.Bold = True 'negrita
                    .Cells(i, "O").Font.Color = RGB(100, 110, 0)
                    .Cells(i, "F") = "-"
                    
                Case "I"
                    .Cells(i, "G").Font.Color = RGB(1, 701, 99)
                    .Cells(i, "G").Font.Bold = True 'negrita
                    
                Case "D"
                    .Cells(i, "G").Font.Color = RGB(1, 170, 99)
            End Select
        Next i
    End With
End Sub

 

publicado

La segunda  es que te modifique cuando modificas cualquier celda de la columna A sin tener que ejecutar la macro manualmente.

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rng As Range
    Set rng = Intersect(Target, Me.Columns("A"))
    If rng Is Nothing Then Exit Sub
    Application.EnableEvents = False
    Call Poneformat
    Application.EnableEvents = True
End Sub

Sub Poneformat()
    Application.ScreenUpdating = False
    With Sheets("Plantilla")
        For i = 17 To .Range("A" & Rows.Count).End(xlUp).Row
            .Cells(i, "G").ClearFormats

            Select Case .Cells(i, "A")
                Case "SI"
                    .Cells(i, "G").Font.Color = RGB(1, 70, 99)
                    .Cells(i, "G").Font.Bold = True 'negrita
                    .Cells(i, "O").Font.Color = RGB(100, 110, 0)
                    .Cells(i, "F") = "-"

                Case "I"
                    .Cells(i, "G").Font.Color = RGB(1, 701, 99)
                    .Cells(i, "G").Font.Bold = True 'negrita

                Case "D"
                    .Cells(i, "G").Font.Color = RGB(1, 170, 99)
            End Select
        Next i
    End With
    Application.ScreenUpdating = True
End Sub

image.gif.8a37055b1d00a05b3361f2cdf8452e54.gif

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.