Friday 10 November 2017

Color Only filled cells in Excel Macros

This post will help you to fill a color in a cell if it has some values. 
Sub NonBlankCells()
    On Error Resume Next
    Union(Cells.SpecialCells(xlCellTypeFormulas, 23), Cells.SpecialCells(xlCellTypeConstants, 23)).Select
    If Err.Number <> 0 Then
        Cells.SpecialCells(xlCellTypeFormulas, 23).Select
           Cells.SpecialCells(xlCellTypeConstants, 23).Interior.Color = vbRed
    Else
        Exit Sub
    End If
    On Error GoTo 0
End Sub
The Output would be :

No comments:

Post a Comment