ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is it possible to ensure Calendar date is in range (https://www.excelbanter.com/excel-programming/330337-possible-ensure-calendar-date-range.html)

Robert Hargreaves

Is it possible to ensure Calendar date is in range
 
I have a dynamic range set to a column with varying dates over a varying
number of rows.

I am asking the user to select a date with a related form. I need the user
to select a date from the calendar control which appears in th dynamic
range. Not within the Min / Max of the range but an exact match.

My Calendar control is named Calendar1 how can I make sure the user picks a
date in the range?

Thank you for any help.

Rob




Bob Phillips[_7_]

Is it possible to ensure Calendar date is in range
 
Hi Rob,

Something like this

Private Sub Calendar1_Click()
Dim mtch
mtch = Application.Match(CLng(Calendar1.Value),
Worksheets("Sheet1").Range("A1:A1000"), 0)
If IsError(mtch) Then
MsgBox ("Invalid date")
End If
End Sub


--
HTH

Bob Phillips

"Robert Hargreaves" wrote in message
...
I have a dynamic range set to a column with varying dates over a varying
number of rows.

I am asking the user to select a date with a related form. I need the

user
to select a date from the calendar control which appears in th dynamic
range. Not within the Min / Max of the range but an exact match.

My Calendar control is named Calendar1 how can I make sure the user picks

a
date in the range?

Thank you for any help.

Rob







All times are GMT +1. The time now is 06:54 AM.

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