PDA

View Full Version : Date Picker Problem



had1015
09-05-2015, 11:09 AM
Hi,

I used to be able to use the regular calendar control with the following code to pick dates and filter data.




Private Sub cmdCancel_Click()
Unload frmCalendar
End Sub

Private Sub cmdOkay_Click()
frmCalendar.Hide
' Unload frmCalendar

End Sub

Private Sub UserForm_Initialize()

'Set starting conditions

With frmCalendar
.Calendar1.Value = Date 'Set to Todays Date
.Calendar1.SetFocus
End With

End Sub



But now I can't get it to function with the new code behind the Date Picker I found from Martin Green as follows:



Private Sub cmdClose_Click()
Unload Me
End Sub

Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
On Error Resume Next
Dim cell As Object
For Each cell In Selection.Cells
cell.Value = DateClicked
Next cell
Unload Me
End Sub

Private Sub UserForm_Initialize()
If IsDate(ActiveCell.Value) Then
Me.MonthView1.Value = ActiveCell.Value
End If
End Sub



Is is possible to have this code modified to my particular needs? Instead of inserting a date in a cell I want to use to with other code to filter data.




frmCalendar.Show
ManagerDate = frmCalendar!Calendar1.Value



Thank you in advance if you can help me.

p45cal
09-06-2015, 09:49 AM
If the workbook's only to be used on a few machines, how about making the old dtpicker work - that's what I did long ago on my machine?

had1015
09-06-2015, 11:11 AM
Thank you for responding p45cal. It will be used on anywhere from 50 to 70 different machines as users will be moving from machine to machine.

p45cal
09-10-2015, 09:59 AM
I think we'll need to know just what Martin Green date picker you're using; can you supply a link, or better, attach or link to your workbook, or a version of it?