Forum Discussion

Sandeeep's avatar
Sandeeep
Brass Contributor
Aug 14, 2022
Solved

VBA: Select multiple Columns till the last row to add a background color.

VBA code help Select multiple Columns till the last row to add a background color with easy-to-read code. Spent the last 3hrs trying everything I could find on the internet.    Problem: I got co...
  • Sandeeep's avatar
    Sandeeep
    Aug 15, 2022

    Found it. https://www.exceldome.com/solutions/color-non-blank-cells/

    Didn't have to dim declare TextCell

        For Each TextCell In Selection
            If TextCell <> "" Then
                TextCell.Font.Italic = True
                TextCell.Interior.Pattern = xlSolid
                TextCell.Interior.PatternColorIndex = xlAutomatic
                TextCell.Interior.ThemeColor = xlThemeColorAccent4
                TextCell.Interior.TintAndShade = 0.399975585192419
                TextCell.Interior.PatternTintAndShade = 0
            End If
        Next

     

Resources