How to insert a date selector in Excel

Source: Internet
Author: User

How to insert a date selector in Excel

In the Development toolbar, select Insert-Other controls, and open other control selection boxes.

Select the Calendar control8.0 in the selection box to determine.

Draw the calendar in the right place and adjust the height and width appropriately. This time the calendar control is also relatively original, do not click on the date automatically hide the calendar and fill in the cell date, then you need to add your own code.

Double-click the calendar in design mode.

Click Design mode to open the Code editor when the color of the chart becomes darker and is the design mode.

Enter the code below at the cursor:

ActiveCell = Calendar1.value Me.Calendar1.Visible = FalseEnd Sub

Private Sub Worksheet_selectionchange (ByVal Target as Range)

If target.column = 1 Or target.column = 2 Then

' Here's 1 and 2 for you to display the column ordinal of the calendar

Me.Calendar1.Left = Target.left Me.Calendar1.Top = target.to If target.value <> "" Then Me.Calendar1.Value = Target. Value Else Me.Calendar1.Value = Now (end I Me.Calendar1.Visible = Truelse Me.Calendar1.Visible = FalseEnd If

Close the Code Editor to save Excel as a macro-enabled workbook.

To open the workbook again, click the first column or the second column to eject the calendar selector, select the date, insert the date in the cell, and the calendar selector disappears. Note that this is only possible in the non-edit mode.

Excel has another simple calendar selector, Microsoft Date and Time picker control (SP6), in addition to the calendar controls.

When you insert the control, you can click on the pop-up date selection interface in non-design mode. As follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.