Creating a Date Selector in Excel VBA?

T

TheRobsterUK

I'm trying to create a spreadsheet that allows you to define maintenanc
schedules for lanscape management work.

The items that are going to be in the maintenance schedule generall
occur yearly (e.g. turf refurbishment) or monthly (e.g. litte
collection, grass cutting).

I want to be able to have a dialog box appear that allows the user t
specify for the yearly items what date of the year maintenance occur
(dd/mm/yyyy) or for the monthly items what date of the mont
maintenance occurs (dd/mm).

Does anyone have any ideas about how best to achieve this? I though
about have 3 textboxes with spinnerbuttons bound to them so the use
can create their own dates by selected the dd/mm/yyyy component
seperately, or maybe 3 drop down lists that do the same thing.

However.......if I did this, how would I stop dates being created tha
don't actually exist? E.g. 30th February, 31st September etc?

I suppose I could write an error handling routine for each mont
selected and check to see if the days selected for that month fal
within an acceptable range e.g. range for September would be:

Range
Septmember_Days >= 1
September_Days < 31

The user would need to click an 'OK' button once they have the dat
entered as they want it, and then the date from the textboxes is passe
to a variable, or perhaps stored in a cell somewhere. Whatever, as lon
as it's retrievable later on in the application.

But is there a better way of doing this? I would have thought Exce
would have some kind of built-in calandar type function to do this sor
of thing but I can't seem to locate it if it does.

Cheers
-Ro
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top