on WS_Activate, highlight row containing current date

robertvdb

Active Member
Joined
Jan 10, 2021
Messages
327
Office Version
  1. 2016
Platform
  1. Windows
I have a sheet with two columns A and B. A contains the dates of this month, B lists the task to perform.

When I activate the sheet, I want the row with today's date to highlight. See image.

Can anyone help ? Thanks.
 

Attachments

  • highlight_line.png
    highlight_line.png
    57.4 KB · Views: 3

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
You should be able to do this easily with Conditional Formatting.

Just select the range A2 down to the end and use the Conditional Formatting formula:
Excel Formula:
=$A2=TODAY()
and choose your desired formatting color.
 
Upvote 0
Thanks Joe, and sorry for late replying.

Whereas I am not pro conditional formatting, in some cases it is hard to avoid, especially in case of a Web-based xlsx where VBA is difficult or impossible.

Best regards and have a nice Sunday.
 
Upvote 0
You are welcome.
While I love VBA, Conditional Formatting is almost always preferrable to VBA. No need to recreate built-in functionality that Excel also has, and VBA has its own restrictions that can sometimes cause issues (i.e. cannot be used in online version, people have to make sure VBA is enabled, etc). VBA is great for handling things for which there is no built-in Excel functionality/formulas.
 
Upvote 0
Thanks Joe. I'll keep that in mind.

One more question: would it be possible to amend your above formula, so that the shading only appears on weekdays ? See enclosed image.
 

Attachments

  • weekdays.png
    weekdays.png
    47 KB · Views: 3
Upvote 0
Thanks Joe. I'll keep that in mind.

One more question: would it be possible to amend your above formula, so that the shading only appears on weekdays ? See enclosed image.
Sure.

Use:
Excel Formula:
=AND($A2=TODAY(),WEEKDAY($A2,2)<6)
 
Upvote 0
Solution

Forum statistics

Threads
1,215,092
Messages
6,123,063
Members
449,090
Latest member
fragment

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