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.
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.