conditional formatting?

X

xp

If any cell in column "B" contains either "Sat" or "Sun" then I want those
rows from columns "B" to "M" to be shaded.

Can this be done using conditional formatting, or do I need to run a macro?

If possible with conditional formatting, how is it done?

Thanks.
 
J

John Bundy

A macro if you need to do the whole row. Here you go, I used UCASE to make it
not case sensitive, you may want to change that.

Sub main()
Dim lastrow As Long
lastrow = Sheet1.Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To lastrow
If UCase(Sheet1.Cells(i, 2)) = "SAT" Or UCase(Sheet1.Cells(i, 2)) = "SUN" Then
Sheet1.Rows(i).Interior.ColorIndex = 4

End If
Next
End Sub
 
J

JLGWhiz

1. Select cells B2:M2
2. From the menu bar: Format, Conditional Formatting
3. Formula Is: =OR($B2= "Sat", $B2="Sun")
4. Patterns: Select the color you want, then click OK
5. Click OK
6. Drag down the sheet for as many rows as needed..
 

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