メインコンテンツへスキップ

最終変更日をExcelのヘッダーまたはフッターに挿入するにはどうすればよいですか?

著者:シャオヤン 最終更新日:2020年05月25日

Excelでは、ファイル名、ファイルのフルパス、現在の日付などのブック情報をヘッダーまたはフッターにすばやく簡単に挿入できます。 しかし、ワークシートの最終変更日時をそれらに挿入しようとしたことがありますか? Excelには、ヘッダーまたはフッターに最終変更日を挿入するためのこの機能はありません。ここでは、これを解決するための便利な方法を紹介します。

最終変更日をVBAコードを使用してExcelのヘッダーまたはフッターに挿入します

最終変更日/作成日/ユーザーヘッダー/フッターをKutoolsforExcelで挿入します 良いアイデア3


矢印青い右バブル 最終変更日をVBAコードを使用してExcelのヘッダーまたはフッターに挿入します

次の簡単なVBAコードは、ワークシートの最後に保存された日付と時刻をヘッダーまたはフッターに挿入するのに役立ちます。次のようにしてください。

1。 最終変更日をヘッダーまたはフッターに挿入するワークシートをアクティブ化します。

2。 次に、 Alt + F11 キーを押して Microsoft Visual Basic forApplicationsウィンドウ.

3。 左側で VBAプロジェクト ペイン、ダブルクリック このワークブック を開く モジュール、次に次のコードをコピーして貼り付けます。

VBAコード:ヘッダーまたはフッターに最終変更日を挿入します

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ActiveSheet.PageSetup.CenterHeader = "Last saved: " & Format(Date, "mm-dd-yy") & " " & Time
End Sub

doc-insert-last-saved-date-to-header-1

4。 次に、このコードを保存して閉じ、クリックします 詳しく見る > ページレイアウト 結果を表示します。 そして、最後に変更された日付と時刻が中央のヘッダーに挿入されていることがわかります。 スクリーンショットを参照してください:

doc-insert-last-saved-date-to-header-2
-1
doc-insert-last-saved-date-to-header-3

注意:

1. Excelファイルを変更して保存すると、最終変更日時が自動的に更新されます。

2.この最後に保存された日付と時刻を左側のヘッダー/フッター、右側のヘッダー/フッター、または中央のフッターに挿入する必要がある場合は、上記のコードのCenterHeaderを要求に合わせて変更する必要があります。


矢印青い右バブル 最終変更日/作成日/ユーザーヘッダー/フッターをKutoolsforExcelで挿入します

Kutools for Excelを使用すると、ブック情報の挿入ツールを使用して、ブック情報をヘッダー、フッター、またはセルにすばやく挿入できます。

Kutools for Excel, 以上で 300 便利な機能は、あなたの仕事をより簡単にします。 

インストールした後 Kutools for Excel、以下のようにしてください:(今すぐExcel用のKutoolsを無料でダウンロードしてください!)

クリック クツールズプラス > ワークブック >ワークブック情報を挿入する、およびポップダイアログで、挿入する情報を確認し、に移動します。 に挿入 セクション、チェック レンジ, ヘッダ or フッター オプションを選択し、必要に応じて左側のヘッダー/フッター、中央のヘッダー/フッター、または右側のヘッダー/フッターに挿入するように指定します。
ドキュメント挿入ワークブック情報
ドキュメント挿入ワークブック情報

矢印青い右バブル ワークブック情報を挿入する


関連記事:

作成した時刻と最終変更時刻を取得してセルに挿入します

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (9)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Why do I have to load the VB code into 'ThisWorkBook' of the VBAproject for every new workbook created? I would think that if I loaded the VB code into 'ThisWorkBook' of VBAHOME (PERSONAL.XLSB) if would be retained and available cresting new workbooks
This comment was minimized by the moderator on the site
Just tried it after moving the center header to the left footer. Didn't work. What I saved at 1:20 pm still recorded as 1:00 pm. Your help would be most appreciated. BTW, my spreadsheet was created as Excel 2007, and I made changes at the library on Excel 2016. Generally, I can go back and forth between versions with no problems.
Also, I didn't realize my name would be published. Any chance of changing it to Nancy E.?
Many thanks!
This comment was minimized by the moderator on the site
THANK YOU! That was invaluable. Who'd believe that Microsoft would exclude such an important function! What about Word? Is it done the same way now?
This comment was minimized by the moderator on the site
Thanks for the Info.
This comment was minimized by the moderator on the site
perfect.very useful ;-)
This comment was minimized by the moderator on the site
I did this and it works. I saved the file as .xlsx and closed it. Now, when I open it, I open the VBA coding window but I am not able to find this chunk of code to edit it. I would like to play with location and remove time. Thank you.
This comment was minimized by the moderator on the site
@John R. When you get to the VBA coding window, on the left section of the screen you need to double-click "ThisWorkbook" to open the right section of the screen. Then in the right section (at the top) you need to select "Workbook" and "BeforeSave". That should hopefully show you the chunk of code that you're looking for.
This comment was minimized by the moderator on the site
I tried this technique but could only get it to show up on one sheet. Help?
This comment was minimized by the moderator on the site
Thanks! I maintain an employee phone number and extension list. People get hired, quit, move to different extensions. If someone wants a copy I print it off, but it only showed the date and time it was printed -- not necessarily the most current information. It was difficult to tell if you had two different copies which one was the most up-to-date. Showing the last time the file was saved will do what I wanted!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations