Office
 Computer >> コンピューター >  >> ソフトウェア >> Office

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

Microsoft Excel では、多くの重要なツールが優れたユーザー エクスペリエンスを生み出します。それらの 1 つが日付ピッカーです。このツールを使用すると、任意の日付と時刻を挿入できます ワークシートで。 カレンダーのようにポップアップします . 日付を選択できます それから。このチュートリアルでは、適切な例と適切な図を使用して、Excel に日付ピッカーを挿入する方法を学習します。詳細については、後のセクションで説明します。それでは、引き続きご期待ください。

Excel で日付ピッカーが便利な理由

現在、人々はユーザー インターフェイスを操作するのが大好きです。仕事のストレスを和らげてくれます。 日付を挿入する方法 セルで?セルに入力することによってですよね?タイピングが忙しいことは誰もが知っています。データセットに 500 行あるとしたら?すべての日付を手動で Excel に挿入したくありません!

ここで私たちを助けるために日付ピッカーが来ます。 日付の挿入に使用できるポップアップ カレンダーです。 そしてそれらを制御します。次のスクリーンショットを見てください:

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

ここで日付ピッカーを見ることができます。このツールを使用すると、任意の日付を選択し、Microsoft Excel で任意の操作を実行できます。

Excel に日付ピッカーを挿入するためのステップ バイ ステップ ガイド

次のセクションでは、Excel に日付ピッカーを挿入するためのステップバイステップ ガイドを提供します。これらすべての手順をよく見て学習することをお勧めします。明らかに Excel の知識を深めることができます。

1. Excel で日付ピッカーの [開発者] タブを有効にする

まず、この日付ピッカー ツールは デベロッパー でのみ使用できます。 タブ。そのため、開始する前に、Microsoft Excel で開発者タブを有効にする必要があります。

それでは、まず開発者タブを有効にしましょう。

📌 ステップ

  • まず、ファイルをクリックします タブ
  • 次に、[オプション] をクリックします .

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

  • さて、Excel のオプションから ダイアログ ボックスで、[リボンのカスタマイズ] をクリックします。 左側のオプション

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

  • ウィンドウの右側から、[メイン タブ] を選択します .
  • 最後に、開発者を確認します ボックス。

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

Excel リボンからわかるように、Microsoft Excel に [開発] タブを挿入することに成功しました。

続きを読む: Excel に曜日と日付を挿入する方法 (3 つの方法)

2.日付ピッカーを挿入

ワークシートに日付ピッカーを挿入します。次の手順に従ってください。

📌 ステップ

  • まず、デベロッパー に移動します タブ
  • コントロールから タブで、[挿入] をクリックします .

<強い> Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

  • ActiveX コントロールから 、[その他のコントロール] をクリックします。

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

  • 次に、Microsoft Date and Time Picker Control 6.0 (SP6) を選択します その他のコントロールから ダイアログ ボックス。

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

  • その後、[OK] をクリックします。 .
  • 最後に、日付ピッカーを挿入するセルをクリックします。

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

ご覧のとおり、セルに日付ピッカー コントロールを挿入しました。

ワークシートに日付ピッカー コントロールを挿入すると、 EMBEDDED が表示されます。 数式バーの数式。

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

これは、このワークシートに埋め込まれたコントロールのタイプを意味します。変更することはできません。 「参照が無効です」と表示されます

続きを読む: Excel の 1 つのセルで日付と時刻を組み合わせる方法 (4 つの方法)

3.日付ピッカーをカスタマイズ

ここでは、日付ピッカー コントロールが見栄えがよくないことがわかります。そのため、見栄えを良くするためにカスタマイズする必要があります。

日付ピッカーを挿入すると、デザイン モードが自動的に有効になります。それを変更することができます。もちろん、そうします。サイズを変更し、プロパティの一部も変更します。

📌 ステップ

  • 日付ピッカーをドラッグするだけで、大きくしたり小さくしたりできます。

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

  • デザイン モードがオンになっている場合は、日付ピッカーを右クリックします。その後、[プロパティ] をクリックします。 .

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

  • ここには、さまざまなオプションが表示されます。そのうちのいくつかと連携します。

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

  • 高さ、幅、フォント、色などを変更できます
  • 次に、日付ピッカーを配置したいセルの位置にドラッグします。

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

これで、日付ピッカーの準備が整いました。カレンダーをセルにリンクするだけです。

続きを読む: Excel のフッターに日付を挿入する方法 (3 つの方法)

4.日付ピッカー コントロールをセルにリンク

あなたはそれを挿入したと思っているかもしれません。しかし、ここに問題があります。日付ピッカーをセルにリンクしなくても、任意の操作を実行できます。 Microsoft Excel は、セルに関連付けられた日付を自動的に認識しません。これなしでは式は機能しないことを忘れないでください。

📌 ステップ

  • まず、日付ピッカーを右クリックします。

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

  • コンテキスト メニューから、[プロパティ] をクリックします。 .

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

  • さて、リンクされたセルで オプションで、接続するセル参照を入力します。

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

  • カレンダーから日付を選択すると、リンクされたセルに日付が自動的に表示されます。 OK をクリックします Excel に「セルの値を NULL に設定できません...」と表示された場合 」 失敗
  • Null 値を受け入れるには、値を FALSE から変更します TRUE チェックボックスに。

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

  • 日付ピッカーを右クリックし、[コードの表示] をクリックした場合 関連する VBA コードが表示されます。

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

続きを読む: Excel はデータを入力すると自動的に日付を入力します (7 つの簡単な方法)

Excel の列全体に日付ピッカーを挿入する方法

さて、これまでに行ったことは、セルに日付ピッカーを挿入することです。セル範囲または特定の列に日付ピッカーを挿入できます。セルをクリックするとカレンダーが表示され、そこから日付を選択できます。次のセクションでは、単一の列と複数の列の両方を挿入する方法を示します。

1.単一の列に日付ピッカーを挿入

📌 ステップ

  • 列全体に日付ピッカーを割り当てるには、日付ピッカーを右クリックします。その後、[コードを表示] をクリックします。 .

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

  • その後、カスタマイズした場合はコードが表示されます。
  • Now, clear the VBA code and type the following code that we are showing here:
Sub Worksheet_SelectionChange(ByVal Target As Range)
 
 With Sheet1.DTPicker1
 .Height = 20 
 .Width = 20 
 If Not Intersect(Target, Range("B:B")) Is Nothing Then 
 .Visible = True 
 .Top = Target.Top 
 .Left = Target.Offset(0, 1).Left 
 .LinkedCell = Target.Address 
 Else 
 .Visible = False 
 End If 
 End With 
 
End Sub

This code basically sets column B as a date picker.

  • Now, deselect the Design mode.
  • After that, click on any cell to remove the Date Picker.
  • Now, click on any cell of column B . You will see date picker control from every cell.

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

Code Explanations:

 With Sheet1.DTPicker1
 .Height = 20 
 .Width = 20 

This code demonstrates the sheet number (Remember your sheet number even if you have changed the name) and the date picker number. Here, we have sheet1(Basic Datepicker sheet)  and date picker 1. Height and width that you set manually.

 If Not Intersect(Target, Range("B:B")) Is Nothing Then 
 .Visible = True 

This code demonstrates that if any cell of column B is selected, the date picker will be visible. Or you can set a custom range like Range(“B5:B14”) . It will set the date picker only for those particular cells in column B .

 .Top = Target.Top 
 .Left = Target.Offset(0, 1).Left 
 .LinkedCell = Target.Address 

The “top ” property basically means it proceeds along with the upper border of the designated cell. It is equivalent to the “top” belongings value of the specified cell.

The “Left ” property is equivalent to the next right cell (of the cell that you specified). It is the length of the left border from the outer left of the worksheet. We used the offset function to get the cell reference of the right cell.

LinkedCell ” connects the date picker with the target cell. When we select the date from the dropdown, it allows that in the cell.

 Else 
 .Visible = False 

When you select any other cell rather than a cell of column C , the date picker won’t show up.

2. Insert Date Picker for Multiple Columns

Now, if you want to set multiple columns with a date picker, you have to make a simple change. Remember, before you set multiple columns with date pickers, you have to insert another date pickers again.

If you want to set a date picker for adjacent columns, you don’t have to write another code segment. Just change in the IF segment:

If Not Intersect(Target, Range("C:D")) Is Nothing Then

Now, the following code will set a date picker for columns B, D, E, G:

Here, we are not assigning the date picker in the entire column. Rather than, we are inserting it in a range of cells. Date picker 1 for B5:B14, Date picker 2 for D5:E14, and Date picker 3 for G5:G14.

Private Sub Worksheet_SelectionChange(ByVal Target As Range) 

 With Sheet1.DTPicker1 
 .Height = 20 
 .Width = 20 
 If Not Intersect(Target, Range("B5:B14")) Is Nothing Then
 .Visible = True
 .Top = Target.Top
 .Left = Target.Offset(0, 1).Left
 .LinkedCell = Target.Address
 Else
 .Visible = False
 End If
 End With

 With Sheet1.DTPicker2 
 .Height = 20 
 .Width = 20 
 If Not Intersect(Target, Range("D5:E14")) Is Nothing Then
 .Visible = True
 .Top = Target.Top
 .Left = Target.Offset(0, 1).Left
 .LinkedCell = Target.Address
 Else
 .Visible = False
 End If
 End With

 With Sheet1.DTPicker3 
 .Height = 20 
 .Width = 20 
 If Not Intersect(Target, Range("H5:H14")) Is Nothing Then
 .Visible = True
 .Top = Target.Top
 .Left = Target.Offset(0, 1).Left
 .LinkedCell = Target.Address
 Else
 .Visible = False
 End If
 End With
 
End Sub

Look here, we have three date pickers here. One for column B , one for columns D and E combined, and another one for column G . After clicking each cell of these columns you will see a calendar. In this way, you can insert a date picker for multiple columns in Excel.

Excel に日付ピッカーを挿入する方法 (段階的な手順を使用)

Big Issue With the Date Picker in Excel

If you are using 64 bit of any Microsoft Excel software or you are using Excel 365 or Excel 2019, you are already confused by now. It is because you couldn’t find the date picker in the ActiveX control.

We are sorry to say Microsoft’s Date Picker control is only available in 32-bit versions of Excel 2016, Excel 2013, and Excel 2010, but it won’t work on Excel 64-bit. So, if you really want to insert a calendar in your worksheet, use any third-party calendar. I hope Microsoft will bring some kind of date picker in the future.

💬 Things to Remember

Make sure to link the date picker with a cell if you are working with one.

Your file should be saved as a Macro-Enabled Workbook (.xlsm).

To make any change to the date picker, make sure to select it from the developer tab.

To see changes from VBA codes, deselect the date picker.

結論

To conclude, I hope this tutorial has provided you with a piece of useful knowledge to insert a date picker in Excel. We recommend you learn and apply all these instructions to your dataset. Download the practice workbook and try these yourself. Also, feel free to give feedback in the comment section. Your valuable feedback keeps us motivated to create tutorials like this.

Don’t forget to check our website Exceldemy.com for various Excel-related problems and solutions.

Keep learning new methods and keep growing!

関連記事

  • How to Display Day of Week from Date in Excel (8 Ways)
  • Insert Last Saved Date in Excel (4 Examples)
  • How to Enter Time in Excel (5 Methods)
  • Change Dates Automatically Using Formula in Excel
  • How to auto populate date in Excel when cell is updated

  1. Excel 差し込み印刷で日付形式を変更する方法 (簡単な手順付き)

    差し込み印刷 は Microsoft Word の優れた機能です . Microsoft Word のこの機能を使用する と Excel データシートを使用すると、必要な数のドキュメントのコピーを作成できます。この記事では、Excel Mail Merge で日付形式を変更する手順を順を追って説明します。 .プロセスについて知りたい場合は、練習用ワークブックをダウンロードしてフォローしてください。 この記事を読みながら練習するために、これらの練習用ワークブックをダウンロードしてください。 Excel 差し込み印刷で日付形式を変更するための段階的な手順 このコンテンツでは、Excel 差し込

  2. Excel for Date で列にテキストを使用する方法 (簡単な手順)

    Excel の使用中 、Excel でテキストから列へのオプションを使用する必要がある場合があります .このオプションは、多くのアクティビティに使用できます。この記事では、Excel の列にテキストを使用して日付を表示する方法を紹介します。 ここでは、必要な図を使用して 3 つの簡単な手順を示します。うまくいけば、この記事はあなたのエクセルスキルを向上させます.記事をお楽しみいただければ幸いです。 ワークブックをダウンロードして練習してください Excel for Date でテキストを列に使用するための段階的な手順 ここからは、テキストを Excel の日付の列に使用する方法の手順を説明