Open workbook on today's date

obrijo

New Member
Joined
Jan 16, 2013
Messages
19
Hello

When I open a workbook & specific worksheet I want to go directly to the cell which contains today's date. The dates are formatted as custom & "dd-mmm". I checked it out online but I failed to get any of the code,macros etc to work.

Cheers

John
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Try like this in the ThisWorkbook module

Code:
Private Sub Workbook_Open()
Dim Found As Range
Sheets("Sheet5").Select
Set Found = Columns("A").Find(what:=Date, LookIn:=xlValues, lookat:=xlWhole)
If Not Found Is Nothing Then Found.Select
End Sub
 
Upvote 0
Possibly another option again to go in the ThisWorkbook module.

Code:
Private Sub Workbook_Open()

    Dim sdate As String, cll As Range, sht As Worksheet
    Set sht = ActiveWorkbook.Sheets("Sheet1")
    sdate = Format(Date, "Short Date")

    On Error Resume Next
    Set cll = sht.Columns(1).Find(what:=CDate(sdate), After:=sht.Range("A1"), LookIn:=xlFormulas _
              , lookat:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
    On Error GoTo 0

    If Not cll Is Nothing Then
        Application.Goto reference:=cll
    End If

End Sub
 
Upvote 0
No luck. getting an error on the Set Sht code line. Changed the sheet to the worksheet I am using. Still getting an error.

John
 
Upvote 0
What does the error actually say and post the code you used (I'm not that good at guessing :))
 
Upvote 0
VoG, I did test my code by saving the workbook to my desktop with the cursor in a different page and then reopening it with the cells formatted as per the OP's post. Is there something you can see that I missed?
 
Upvote 0
Hi Mark. I didn't mean any criticism of your code. I just knew that mine worked when I tested it and my post was meant for the OP.
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,378
Members
448,955
Latest member
BatCoder

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