Calendar Control, Weekly

F

ForSale

I currently have a userform with a Calendar Control 10.0 on it. Righ
now it only lets the user select one day at a time. I need a way fo
the user to select a week at a time (Mon-Sun).

What is the best method? Can I continue to use the Calendar Control?
Should I make a different userform with a listbox or combobox?

Thanks
 
M

Mike Fogleman

You can still use the Calendar control, but you will have to build the week
using VB or cell formulas. Let's assume your user picks Wed, Aug 9, 2006 on
the calendar. That date is then placed in A20. Put the days of the week in
cells B19:H19, starting with monday. In cell B20 put this formula:
=IF(WEEKDAY(A20,2)=1,A20,A20-(WEEKDAY(A20,2)-1))
in cell C20 put: =B20+1
in cell D20 put: =C20+1
in cell E20 put: =D20+1
in cell F20 put: =E20+1
in cell G20 put: =F20+1
in cell H20 put: =G20+1

Your formulas create a week that starts on Monday 8/7/2006 and ends Sunday
8/13/2006
No matter what day of the week the user selected. Works for any week.

Mike F
 

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