Excel Conditional Cell Formatting

Closed
Report
-
 Aphelion -
Hello,

I need an MS Office Excel 2007 formula. I want to fill multiple cells in a row with color IF one particular cell in the row is divisible by 5. The particular cell with the number in it contains a formula (example: =$C$1-C65)

Thanks for any help you can give.

Nancy

1 reply

Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
804
the cdoe will be something like this (modify to suit you)

Sub test()
Dim r As Range, c As Range
Set r = Range("c1:c65")
For Each c In r

If c Mod 5 = 0 Then c.EntireRow.Interior.ColorIndex = 3
Next c

End Sub
3
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2821 users have said thank you to us this month

Thank you for your reply. It is still way over my head, though. Would it be possible to dumb it down? What, exactly, would I put in the cell? Where do I enter the formula? Where do I set the range?

Thanks...
> Nancy
The script above is actually a VBA script.
Access VBA by using ALT+F11 while in Excel.