Select today's date

Reec0n

New Member
Joined
Jan 30, 2017
Messages
20
I have a sheet with dates for the whole year running from B2 all the way to NB2 for all of 2018.

When I open the sheet I would like today's the date to be highlighted and potentially the whole column.

If it's easy to simply do the date, that will suffice.

tia all
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Right click the tab name, select "View Code" and paste the following:

Code:
Private Sub Worksheet_Activate()

Cells(2, Date - Range("B2").Value + 2).EntireColumn.Select

End Sub

WBD
 
Upvote 0
Another alternative:
Code:
Private Sub Worksheet_Activate()
    Dim LastRow As Long
    LastRow = Sheets("Sheet1").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim foundDate As Range
    Set foundDate = Sheets("Sheet1").Rows(2).Find(Date, LookIn:=xlFormulas, lookat:=xlWhole)
    If Not foundDate Is Nothing Then
        Sheets("Sheet1").Range(Sheets("Sheet1").Cells(2, foundDate.Column), Sheets("Sheet1").Cells(LastRow, foundDate.Column)).Interior.ColorIndex = 3
    End If
End Sub
Place the macro in the worksheet code module.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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