Translate

Tuesday, July 5, 2011

Insert a Drop Down Calendar Menu In Excel – Choose a Date!

So you want to create a drop down calendar in Excel? Apart from sending alerts to Outlook from Excel (working on that article as well) this has been the most requested how-to as of late. For example:



This seems like it would be so easy yet when you look around on-line the answers are all full of VBA scripts and custom code.
I assume you just want someone using the spreadsheet to be able to select a cell, have a calendar drop down and then populate the field with whatever date the person chooses. Yes it can be done. Yes it is fairly involved. And yes, I have a workaround.
Would you like the easiest, cheesiest, sleaziest way to do this? Well then watch this:
The first thing you need to do is enable the Developer Tab in Excel.
  1. Select the Pearl or “Office Button” in Excel. The Pearl is the ball in the top left corner that gives you the option to Print, Save, etc.
  2. With the Pearl menu open select Excel Options from the very bottom on the right.
  3. Another menu will open – Select Popular
  4. Check the box for “Show Developer Tab in the Ribbon
Now you have the developer tab with all the controls for forms, xml, code, etc.
Go to the developer tab and select Insert, followed by the little Pink Floyd-esqueMore Controls icon.
Scroll through the list of controls and look what’s available. There are all sorts of funky add-ins you can use in your spreadsheets! We are looking for the Microsoft Date and Time Picker Control
Highlight it and select OK.
Your mouse will turn in to a cross hair – click and hold, draw a rectangle, release. You now have a date box!
You will also see code in the top akin to “=EMBED(“MSComCtl2.DTPicker.2″,”")”
You will also notice that you are in Design Mode because that icon is highlighted. This allows you to play with the settings for the date box you just created.
Deselect Design Mode and you have a date control! Select the drop down and a calendar appears! Holy Cow that’s super cool awesome but guess what! It doesn’t do anything!
You can click it and change the date as much as you want but nothing else is changing in your spreadsheet!
Here is where the genius of my non-code writing laziness pays off. Ready?
What cell do you want the date to change in? Let’s say C5
  1. Ok, In B5 type SELECT DATE:
  2. In D5 enter the formula =C5
  3. Still got that calendar control visible like in the image above?
  4. Let’s go back to Design Mode by clicking it. Move the calendar control box up around the C3 area just to move it out of the way.
  5. Right Click in the calendar control and select Properties.
  6. A properties menu will open up
  7. Look for the field Linked Cell and enter C5 (that’s where we want the date change to happen)
  8. You might get an error message – ignore it!
  9. Close the Properties menu
  10. Deselect Design Mode
Here’s where it all comes together. .
  1. Select the Date Drop down and change the date
  2. You will see Cell C5 change to that date
  3. You will see cell D5 (which =C5) change as well. The D5 was just to ensure that C5 was actually showing a date.
  4. Repeat step 1-3 until you are as giddy as a little girl.
Last Question: How do I use this?
Well you can create as many of these drop downs as you like. You can tell each one what cell to update (Linked Cell) and you can move the Date Control right over the top of the field it is updating!  Think about that – Move the date picker right over the top of the cell it is linked to. Only you know the truth! There is no advanced code, you’re just hiding the data in C5 under the Date control that is updating or controlling C5! Then do any date calculations you need to do using C5 as the reference!

No comments:

Share It

Related Posts Plugin for WordPress, Blogger...