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