Microsoft Office Tutorials and References
In Depth Information
Providing a Calendar to Choose Dates for Input
End Select¶
Next Cll¶
Exit Sub¶
'error handler - errors jump to this location and the procedure ends¶
err_h:¶
End Sub¶
View the Appendix to learn how to store this procedure
in a Worksheet module.
Exl
Option Explicit¶
' * * * * *¶
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _¶
Cancel As Boolean)¶
'Ask for a date for any cell in column A¶
Dim Cll As Range¶
If Intersect(Target, Range("A:A")) Is Nothing Then¶
Exit Sub¶
'Range ("A:A") restricts the macro to column A. This can¶
'be changed to whatever range is desired.¶
End If¶
For Each Cll In Intersect(Target, Me.Range("A:A"))¶
DisplayCalendar Cll¶
Cancel = True¶
Next Cll¶
End Sub¶
Place the following code in the UserForm ‘fmCalendar’. The example file has
the form with the code already in it. This form has a calendar control and a
command button.
View the Appendix to learn how to store this procedure
in a UserForm.
Option Explicit¶
Private mChoice As Variant 'Holds the choice of the user¶
' * * * * *¶
Private Sub BCancel_Click()¶
'User cancelled¶
mChoice = False¶
Me.Hide¶
End Sub¶
' * * * * *¶
Private Sub Calendar1_Click()¶
mChoice = Calendar1.Value¶
Me.Hide¶
End Sub¶
Search JabSto ::




Custom Search