ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calendar popup (https://www.excelbanter.com/excel-programming/384676-calendar-popup.html)

jnf40

Calendar popup
 
I am using the calendar1 popup. Is there a way to make the dates prior to
Todays date unselectable?

Chip Pearson

Calendar popup
 
I don't think you can prevent the user from clicking an earlier date, but
you can intercept the Click event and set the Value to the current date:

Private Sub Calendar1_Click()
If Me.Calendar1.Value < Int(Now) Then
Me.Calendar1.Value = Int(Now)
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"jnf40" wrote in message
...
I am using the calendar1 popup. Is there a way to make the dates prior to
Todays date unselectable?




Tim

Calendar popup
 
Hi jnf40,

you could do something like this (added to teh click event f the
calendar): -
=====

Private Sub Calendar1_Click()
If Calendar1.Value < Now() Then
MsgBox "can't select dates before today"
Calendar1.Value = Now()
End If
End Sub

=====
hth,

tim

"jnf40" wrote in message
...
I am using the calendar1 popup. Is there a way to make the dates prior to
Todays date unselectable?





All times are GMT +1. The time now is 12:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com