Macro to highlight a row if cells match value [Solved/Closed]

sgriffis - Feb 22, 2011 at 09:02 AM - Latest reply:  sgriffis
- Feb 22, 2011 at 10:29 AM

I sorry but I am very new to macros and trying to create one in Office 2003. I need to bold a row if for example column E is greater than a given value and column H is today's date or earlier.

So if Column E >= 50 AND column H is today or an earlier date then bold that row.

Any help is appreciated.

See more 

2 replies

Best answer
TrowaD 2433 Posts Sunday September 12, 2010Registration dateContributorStatus September 17, 2018 Last seen - Feb 22, 2011 at 09:45 AM
Thank you
Hi Sgriffis,

Try this code:

Sub test()
Set MR = Range("E1:E100")
For Each cell In MR
If cell.Value >= 50 And cell.Offset(0, 3).Value <= Date Then cell.EntireRow.Font.Bold = True
End Sub

You stated that you are very new to VBA so here's how to implement the code:

In excel goto top menu > extra > macro > visual basic editor (or ALT F11).
A new window will open, goto top menu > insert > module.
Copy the code in the big white field.
Adjust the name "test" to whatever name you want to give this macro.
Adjust the range ("E1:E100") to whatever range you use in your file.
You can now close the visual basic editor window.
Back at excel goto top menu > extra > macro > macro's (or ALT F8).
Choose to run the macro "test" or whatever name you changed it into.

Note: Actions made by macro cannot be undone using the blue arrows!
So it is always best to save before running a macro, if the desired result doesn't show up you can simply reload your file.

Best regards,

Thank you, TrowaD 2

Something to say? Add comment

CCM has helped 1786 users this month

Thank you
Perfect, thanks!