miércoles

Colorear celda en filtro activo

Hola
A veces algunos usuarios se pierden, en sus bases de datos, cuando estan haciendo muchos filtros, en el sentido de que Excel da color nada mas a la flechita del filtro activo, pues bien lo que tratan las siguientes macros es de colorear el encabezado donde existe un filtro de datos

Sub colorearceldafiltro()
Application.ScreenUpdating = False
With ActiveShee
tucol = .Range("A1", .Range("A1")).End(xlToRight).Column If .AutoFilterMode Then
With Range(Cells(1, 1), Cells(1, ucol))
.Interior.ColorIndex = 0
.Font.ColorIndex = 0
End With
For col = 1 To ucol
With .AutoFilter.Filters(col)
If .On Then
'c1 = .Criteria1
With Cells(1, col)
'.Value = "'" & VBA.Mid(c1, VBA.InStr(c1, "=") + 1, 100)
.Font.ColorIndex = 2
.Interior.ColorIndex = 1
End With
End If
End With
Next col
End If
End With
Application.ScreenUpdating = True
End Sub


Revisar el adjunto para pruebas y espero sea de utilidad

Saludos

No hay comentarios:

Publicar un comentario