Date selector combobox

S

Steve P

Hello Excel gurus...

I am building a userform that will be used to drive a search engine for a
project I'm working on. I have two comboboxes on the form and want the two
comboboxes to be used to select a "start" date and a "end" date to select a
user specified date range. What is the best way to accomplish this?
 
D

Dave Peterson

If the dates that the user can choose are known, you could add the dates when
you load the userform:

Option Explicit
Private Sub Userform_Initialize()
dim myDate as date
for mydate = dateserial(2008,1,1) to dateserial(2008,2,12)
me.combobox1.additem format(mydate,"mmmm dd, yyyy")
next mydate
end sub

But if there are lots and lots of dates, this becomes a pain for the user to
find the correct date to choose.

You may want to consider using a calendar control.

Ron de Bruin has some notes:
http://www.rondebruin.nl/calendar.htm

Or even 3 different controls (day, month, year) for each date.
 

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