Fill with Gray if Column b is bold

C

C

My spreadsheet contains data from column A1 to K?. There may be 10 rows or
1000 rows. I need to look at column B and if it the font is bold then I need
to fill A:K with gray. Can someone help?

Thanks in advance,

CB
 
G

Gord Dibben

Sub fill_gray()
Dim rng As Range
Dim c As Range
Set rng = ActiveSheet.Range(Cells(1, 2), _
Cells(Rows.Count, 2).End(xlUp))
For Each c In rng
If c.Font.Bold = True Then
Range("A" & c.Row & ":K" & c.Row).Interior.ColorIndex = 15
Else
Range("A" & c.Row & ":K" & c.Row).Interior.ColorIndex = xlNone
End If
Next c
End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top