VBA Add a Calendar control action

Source: Internet
Author: User

Need to make a VBA macro in recent days, to facilitate the selection of the format date in Excel, the need to add a calendar control, and according to the format of the output, because it is the first time to contact VBA, so query some information, the following for their own process to summarize:

1. Create a new Excel document first.

2. Add a Calendar control to an Excel document, as follows:

Insert a Calendar control in another control, such as:

When you are finished adding the following as shown:

You can write code by double-clicking the control, as follows

Private Sub Calendar1_click ()

ActiveCell = Calendar1.value
Calendar1.visible = False
End Sub

Private Sub App_sheetselectionchange (ByVal Sh as Object, ByVal Target as Range)
If Target.Column = 3 Then
Calendar1.visible = True
Else
Calendar1.visible = False
End If

End Sub

Click on the design mode in Excel above to save the results.

VBA Add a Calendar control action

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.