Selecting current date on a sheet

Kenneth

New Member
Joined
Aug 22, 2002
Messages
3
I have a column of dates and when I open the file I would like the current date to be showing in the screen so the user doesn't always have to scroll down to find it or use the find tool.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Actually the column already has a list of dates out to about 2 years. I would like to select the cell that has the current date when it is open. I tried using find but it gave me error (object variable or with variable not set) when I tried to use "Date" in the "what" argument instead of actual text. Below is the code.
Private Sub Auto_Open()

Cells.Find(What:=Date, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate

End Sub
 
Upvote 0
Hi Kenneth,

Hope this does what you want. Add the code to your 'open' event.



Dim aRange As Range
Dim aCell As Range

Set aRange = Sheet1.Range("RangeOfDates")

For Each aCell In aRange
If CLng(aCell.Value) = CLng(Date) Then
aCell.Select
Exit For
Else
aCell.Offset(1, 0).Select
End If
Next aCell
 
Upvote 0
On 2002-08-23 09:11, Kenneth wrote:
I have a column of dates and when I open the file I would like the current date to be showing in the screen so the user doesn't always have to scroll down to find it or use the find tool.

How about using conditional formating for the cells where the dates are already entered

for cell A1, use ... FORMULA IS ... =A1=today() -- then Format|Patterns|Color

Please post back if it works for you ... otherwise explain a little further and let us take it from there.

Regards!

Yogi
 
Upvote 0
The code works perfectly and the conditional formatting added a nice touch to the project. I can't thank you enough. This is an awesome web page!!
 
Upvote 0

Forum statistics

Threads
1,225,761
Messages
6,186,891
Members
453,383
Latest member
SSXP

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