Results 1 to 3 of 3

Thread: Date Selection UserForm in Excel VBA

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2004
    Location
    Right here
    Posts
    275

    Resolved Date Selection UserForm in Excel VBA

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

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

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

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

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

    I suppose I could write an error handling routine for each month selected and check to see if the days selected for that month fall 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 date entered as they want it, and then the date from the textboxes is passed to a variable, or perhaps stored in a cell somewhere. Whatever, as long as it's retrievable later on in the application.

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

    Cheers
    -Rob
    Last edited by TheRobster; Nov 25th, 2004 at 05:57 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width