OzGrid

How to jump to the cell with current date when open an Excel file

< Back to Search results

 Category: [Excel]  Demo Available 

How to jump to the cell with current date when open an Excel file

 

Requirement:

 

The user would like to know hho to jump to the cell with current date when open an Excel file.

 

https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/1206381-how-to-jump-to-the-cell-with-current-date-when-open-an-excel-file

 

Solution:

 

In order to jump to Today's date ... you could test following event macro:

Code:
Private Sub Workbook_Open()
' Macro to jump to Today's Date
Dim dateRng As Range
Dim DateCel As Range
Dim dateStr As String
  Worksheets("Sheet1").Select
  Set dateRng = Range("4:4")
    For Each DateCel In dateRng
        DateCel.Activate
        ActiveCell.Select
        On Error Resume Next
        dateStr = DateCel.Value
        If dateStr = Date Then
            DateCel.Select: Exit Sub
        End If
    Next DateCel
End Sub

 

Obtained from the OzGrid Help Forum.

Solution provided by Carim.

 

See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets

 

See also:

How to use a code to display the current date based on certain criteria
How to copy range from variable named workbook to current workbook
How to create VBA to place current month and year in a cell

 

Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.


Gallery



stars (0 Reviews)