Vba higlight row if cell in above row = true

colbecd

New Member
Joined
Apr 30, 2009
Messages
25
Hi

I am trying to figure out a formla so that if the cell for example V2 = True then the row below 3 in this case is highlighted blue.

There can be up to 500 rows in total and want all rows below the word true to be highlighted in blue if that makes sense?

does anyone have any suggestions?

Many thanks in advance?!

Dan
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Hi,

Try Conditional Formatting. It is on the Home Tab in the Styles section.

Select the area you want the format to apply to. Note, it can't apply to row 1 because you can't have a value of True above it. SO select from row 2 onwards.
Click on Conditional Formatting.
Select New Rule.
Select "Use a formula to determine which cells to format".
In the "Format values where this is true" box, enter =$V1
Then click the Format button and choose Fill to select the colour you want.
Click OK on that screen and the next one.

The rows with cell V in the row above should now be blue.

If that doesn't work - and I struggle with Conditional Formatting - try this:

Go back into Conditional Formatting.
Select Mange Rules.
Make sure "Show formatting rules for" is set to This Worksheet.
Check you have an entry which says: Formula =$V1 and it applies to something like: =$A$2:$AB$500
(I chose columns from A to AB and rows up to 500.)
Click OK.
 
Upvote 0
Hello,

Try Below code:

Sub ColorHighligh()
Dim c As Range
Dim LR As Integer
Dim numProbs As Long
Dim sht As Worksheet


Set sht = Worksheets("Use your Sheet Name")


numProbs = 0
LR = sht.Cells(Rows.Count, "V").End(xlUp).Row
For Each c In sht.Range("V2:V" & LR).Cells
If Len(c.Value) < 6 And Len(c.Value) > 2 Then
c.EntireRow.Cells(2, 21).Resize(3, 3).Font.Color = vbBlue
numProbs = numProbs + 2
End If
Next




End Sub
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,039
Members
448,940
Latest member
mdusw

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