Home » excel » excel date picker control

excel date picker control

Posted by: admin March 9, 2020 Leave a comment

Questions:

I need to create an in cell date picker for a excel worksheet I’m creating.

I’m trying to follow this tutorial

However i cant understand how the example is supposed to place a calendar picker in cell A1:C1. In my worksheet, if i paste the code as is, it throws an error. if i try to modify it like so:

'Declaration
Public Function AddDateTimePicker(range As range, name As String) As DateTimePicker   

Private Sub ExcelRangeAddDateTimePicker()
Dim DateTimePicker1 As Microsoft.Office.Tools.Excel.Controls.DateTimePicker
DateTimePicker1 = Me.Controls.AddDateTimePicker(Me.range("A1", "C1"), "DateTimePicker1")       
End Sub

I get no result at all…

Any tip or answer is appreciated 🙂

How to&Answers:

I found a better example for a working Excel 2010 Calander than what i had discovered previously.

This Tutorial is really good, and helps you to create a pop up Calander for Excel 2010:
http://www.fontstuff.com/vba/vbatut07.htm

I found it at the bottom of the page linked by brettdj. Thank you 🙂

Answer:

This VBA version from Trevor Eyre looks pretty great and is well documented. One line of code opens the VBA form and gets the date:

myDate = CalendarForm.GetDate

http://trevoreyre.com/portfolio/excel-datepicker/

-OO-