跳到主要內容

如何在Excel中快速跳轉到具有當前日期的單元格?

這是帶有日期列表的工作表,您想快速跳轉到當前日期所在的單元格,如何解決此問題?

使用VBA跳轉到當前日期

使用查找和替換跳轉到當前日期


箭頭藍色右氣泡 使用VBA跳轉到當前日期

這是一個VBA代碼,可以幫助您快速跳轉到當前日期所在的單元格。

1.啟用要使用的工作簿,然後按 Alt + F11鍵 鍵打開 Microsoft Visual Basic for Applications 窗口。

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.啟用包含日期列表的工作表,然後選擇一個空白單元格,鍵入以下公式 =今天(), 按 Enter 鍵,現在您可以獲得今天的日期。
doc跳至當前日期3

2。 按 按Ctrl + C 複製今天的日期,然後選擇日期列表,然後按 Ctrl + F 使之成為可能 查找和替換 對話框中 查找內容 文本框,按 按Ctrl + V 將今天的日期粘貼到看截圖:
doc跳至當前日期4

3。 點擊 找到所有。 現在,光標跳到所選列表中今天所在的單元格。
doc跳至當前日期5

小提示: 如果你有 Excel的Kutools,您可以應用它 選擇特定的單元格 快速處理這個任務。30天內功能齊全,無限制, 請下載並立即免費試用。
doc跳至當前日期6

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為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