Macro to highlight a row if cells match value
Solved/Closed
Related:
- Macro to insert row in excel based on criteria
- Spell number in excel without macro - Guide
- Excel macro to create new sheet based on value in cells - Guide
- How to change account based in instagram - Instagram Forum
- Insert tick in word - Guide
- If cell contains (multiple text criteria) then return (corresponding text criteria) ✓ - Excel Forum
2 responses
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
552
Feb 22, 2011 at 09:45 AM
Feb 22, 2011 at 09:45 AM
Hi Sgriffis,
Try this code:
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,
Trowa
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 Next 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,
Trowa