ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple way to input dates (https://www.excelbanter.com/excel-programming/275117-simple-way-input-dates.html)

Wes[_3_]

Simple way to input dates
 
Just wondering if there is a simple way to have a user
input a date. I have been trying to make a user form
where a user will input a valid date. I made dropdown
lists to choose month day and year, but I don't want the
user to be given the choice to select an invalid date. In
otherwords I need to make sure that the number of days in
a month is correct.

I intend to further narrow down the choice of valid dates
to being only weekdays and not holidays, in case this
changes your opinion on what the best solution for me
would be.

Thanks in advance for any advice!


Orlando Magalhães Filho

Simple way to input dates
 
Hi Wes,

Look for "Text Box to input dates in VBA code" at this site:
http://cpap.com.br/orlando

For filter weekend days do this:
- Look for this line comments on the code: 'Limiting the date. (If you don't
want limit, remove the below lines)
- Above this line add something like this:
If Application.WorksheetFunction.Weekday(DateValue(i) ) = 1 Or
Application.WorksheetFunction.Weekday(DateValue(i) ) = 7 Then
MsgBox "Invalid Date. Sunday and Saturday are invalid", vbCritical,
"CPAP®"
Cancel = True
End If
'The same way you can filter holidays from here

--
HTH

---
Orlando Magalhães Filho

(So that you get best and rapid solution and all may benefit from the
discussion, please reply within the newsgroup, not in email)



HTH

---

(So that you get best and rapid solution and all may benefit from the
discussion, please reply within the newsgroup, not in email)

"Wes" escreveu na mensagem
...
Just wondering if there is a simple way to have a user
input a date. I have been trying to make a user form
where a user will input a valid date. I made dropdown
lists to choose month day and year, but I don't want the
user to be given the choice to select an invalid date. In
otherwords I need to make sure that the number of days in
a month is correct.

I intend to further narrow down the choice of valid dates
to being only weekdays and not holidays, in case this
changes your opinion on what the best solution for me
would be.

Thanks in advance for any advice!





All times are GMT +1. The time now is 05:23 PM.

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