跳到主要内容

如何在Excel中快速跳转到具有当前日期的单元格?

这是带有日期列表的工作表,您想快速跳转到当前日期所在的单元格,如何解决此问题?

使用VBA跳转到当前日期

使用查找和替换跳转到当前日期


箭头蓝色右气泡 使用VBA跳转到当前日期

这是一个VBA代码,可以帮助您快速跳转到当前日期所在的单元格。

1.启用要使用的工作簿,然后按 Alt + F11键 键打开 Microsoft Visual Basic应用程序 窗口。

2。 点击 插页 > 模块,将以下代码粘贴到 模块.

VBA:跳转到当前日期

Private Sub Workbook_Open()
'UpdatebyExtendoffice20161221
    Dim daterng As Range
    Dim DateCell As Range
    Dim WorkSht As Worksheet
    Dim dateStr As String
    Application.ScreenUpdating = False
    For Each WorkSht In Worksheets
        WorkSht.Select
        'Set daterng = Range("A:A")
        Set daterng = WorkSht.UsedRange
        'daterng.Select
        For Each DateCell In daterng
            DateCell.Activate
            ActiveCell.Select
            On Error Resume Next
            dateStr = DateCell.Value
            If dateStr = Date Then
                DateCell.Select
                Exit Sub
            End If
        Next
    Next WorkSht
    Application.ScreenUpdating = True
    'Worksheets(1).Select
End Sub

doc跳至当前日期1

3。 按 F5 键,然后光标将跳到带有当前日期的单元格,无论您在工作簿中的什么位置。
doc跳至当前日期2


箭头蓝色右气泡 使用查找和替换跳转到当前日期

如果您不熟悉VBA代码,也可以应用 查找和替换 实用程序跳转到当前日期。

1.启用包含日期列表的工作表,然后选择一个空白单元格,键入以下公式 = TODAY(), 按 输入 键,现在您可以获得今天的日期。
doc跳至当前日期3

2。 按 按Ctrl + C 复制今天的日期,然后选择日期列表,然后按 Ctrl + F 使之成为可能 查找和替换 对话框中 查找内容 文本框,按 按Ctrl + V 将今天的日期粘贴到看截图:
doc跳至当前日期4

3。 点击 找到所有。 现在,光标跳到所选列表中今天所在的单元格。
doc跳至当前日期5

提示: 如果你有 Kutools for Excel,您可以应用它 选择特定的单元格 快速处理这个任务。30天内功能齐全,无限制, 请下载并立即免费试用。
doc跳至当前日期6

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (4)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
This example is horribly slow. You could probably trim some of the find parameters, so test if you want.
Code:

'Find todays date in the sheet and activate cell
Cells.Find(What:=Date, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
'-----

ActiveWindow.ScrollRow = ActiveCell.Row 'scroll view to selected cell
This comment was minimized by the moderator on the site
I am a novice with Microsoft Office, and Excel, but I am a programmer by nature. If the objective is to locate a cell with today's date - and position the cursor to it, I can't see the need for all that code.A simple code (listed below) created in a macro, and assign the macro to a letter say "T", and as an option you may even created a button and assign the macro to it, so when you click the button you will travel directly to that cell.The comments lines (those that start with ') are optional. You may choose not to type them. I used them for troubleshooting the code. "Msgbox" is a nice tool to communicate with you.Here is my code:---------------------------------Sub GoToToday()
'
' GoToToday Macro
'
' Keyboard Shortcut: Ctrl+t
'
Dim DateRange, DateCell As Range
Dim i As Byte
Dim x As String
On Error Resume Next

MySheet = ActiveSheet.Name

' MsgBox (Date)
For i = 12 To 130
x = "A" & i
' MsgBox (x)
' MsgBox (Worksheets(MySheet).Range(x))

If Worksheets(MySheet).Range(x).Value = Date Then
' MsgBox (i)
' MsgBox (x)
' MsgBox (Worksheets(MySheet).Range(x))
x = "D" & i
Range(x).Select
Exit Sub
End If
Next:
End Sub

This comment was minimized by the moderator on the site
Same results as Peter ... F5 brings up GoTo. We also tried Ctrl-F5 and Alt-F5. Is there some other key sequence or addition to the code? Thanks.
This comment was minimized by the moderator on the site
This doesn't work with the VBA code, it just brings up a window called "Go To". Were we meant to edit the VBA code in some way?
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations