2

I need to add a datepicker in Excel in a custom vba form.

I know that I can use MSCOMCT2.ocx but it seems to be obsolete with Excel 2010 : user will have to install a custom package.

I need that the code will work from Excel 2003 to 2010 without installation (or at least without throwing an error message if the component isn't available). I can't control the running environnement.

IS there any solution ? like a custom datepicker in full vba ?

P. Sohm
  • 2,842
  • 2
  • 44
  • 77
  • 1
    [solved here](http://stackoverflow.com/questions/12258875/adding-datetimepicker-to-userform-using-vba) – Jook Sep 06 '12 at 15:44

2 Answers2

3

I've used the following successfully on a roll-out to a mix of Excel 2003 and 2007. The authors do say it should be compatible with all versions.

https://sites.google.com/site/e90e50/calendar-control-class

Michael
  • 507
  • 1
  • 5
  • 16
0

Instead of date picker, i am using auto populate in all the date column in my excel. Please see below.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim xRg As Range, xCell As Range
On Error Resume Next
If (Target.Count = 1) Then
    If (Not Application.Intersect(Target, Me.Range("H4,H7")) Is Nothing) Then _
        Target.Offset(0, x1down) = Date
    Application.EnableEvents = False
    Set xRg = Application.Intersect(Target.Dependents, Me.Range("H4,H7"))
    If (Not xRg Is Nothing) Then
        For Each xCell In xRg
            xCell.Offset(0, x1down) = Date
                        Next
    End If
    Application.EnableEvents = True
End If
End Sub
Ryan Nguyen
  • 25
  • 1
  • 9