Colour cells if condition met

Sliepner

New Member
Joined
Aug 20, 2018
Messages
6
I have a rota in which I would like to have all the cells in a row with text/numbers in them highlight blue if there is an N in eg column A. i am trying to avoid conditional formatting if possible.
The image is a snip from a Rota.
The N in the 1st column signifies night shift
1 signals they are here
M* mobilising
D* departing

Is this possible, and if so, what is the best way to achieve. The rota has over 800 rows and covers a year, 1 column per day. We have previously used conditional formatting, but as the rota is used pretty much all day, every day, the formatting inevitably splits and grows exponentially making the spreadsheet slow.

Any advice gratefully received.
Excel  Capture.PNG
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Why is the column with the 1s shaded when you said you wanted rows shaded when the A column has an "N" ?

I think if you don't use conditional formatting you'll have to use VBA.
 
Upvote 0
Maybe something like this?

Code:
Sub ShadeRows()
Dim RowCount As Long, ColCount As Long, i As Long, rng As String

Application.ActiveSheet.UsedRange
RowCount = Worksheets("ROTA").UsedRange.Rows.Count
ColCount = Worksheets("ROTA").UsedRange.Columns.Count

For i = 1 To RowCount
 If Cells(i, "A") = "N" Then
 rng = Range(Cells(i, "A").Address, Cells(i, ColCount).Address).Address
 Range(rng).Interior.ColorIndex = 34
 Else
 End If
Next

End Sub
 
Upvote 0
Ah, yes the column which is orange is todays date :)
Why is the column with the 1s shaded when you said you wanted rows shaded when the A column has an "N" ?

I think if you don't use conditional formatting you'll have to use VBA.
Ah yes, sorry I forgot to add that the orange column is todays date
 
Upvote 0

Forum statistics

Threads
1,214,813
Messages
6,121,706
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top