Excel Drop-Down Box with a Calendar :: MrExcel Message Board



 FAQFAQ
   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   StatisticsStatistics 
 RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Online StoreOnline Store

MrExcel Message Board Forum Index -> Excel Questions

Drop-Down Box with a Calendar
Post new topic   Reply to topic
Last Thread | Next Thread  >   Printable version
  Author    Thread

TJ
Welcome to the Board


Joined: 02 Aug 2002
Posts: 3


Status: Offline

 Reply with quote  

Is there a way to set up a designated cell in a spreadsheet with a drop-down box that will have a calendar, so that when you click on a date in the calendar it puts that date in the cell?

Post Fri Aug 02, 2002 12:56 pm 
 View user's profile Send private message

Nimrod
MrExcel MVP


Joined: 30 Apr 2002
Posts: 2511
Location: Vancouver BC , Canada

Status: Offline

 Reply with quote  

TJ:
I think I've been able to create something that will meet your needs nicely... however it will require about 5 lines of VBA code ... is that OK ? If so continue to read.

The Resulting Method
( This is the result if the VBA code and form is produced )
When you want a date in a particular cell
1- Click once on the cell where you would like date
2- Press Ctrl+d ( a calender will appear)
3- Double click on date in Calender
4- Date is entered in selected cell
5- Calender disappears

HOW TO MAKE IT HAPPEN

First: Make a VBA form
1- Open VBA editor
2- Goto VBA toolBar
3- Select "Insert" from VBA toolbar
4- Select "UserForm" from drop down menu
(you have created a userform called "userform1"

Second: Put calander on userform
1-In VBA window select the "toolbox"
2- Right click on "toolbox"
3- Select "additional controls" item from drop down menu
4- check/select "calender control" from the window that will appear
5- a calender object will appear on the "toolbox"
6- Drag and size the calender object from the "toolbox" to "userform1"

Third : Write VBA code for calender
1- Once calender is on userform1 then "double click" the calender...the VBA code window for the calender will open
2- Insert the following code

code:

Private Sub Calendar1_DblClick()

ActiveCell.Value = Calendar1.Value
UserForm1.Hide
Unload UserForm1
End Sub




Fourth Write code to make calender appear
-1 In VBA window select "insert" from VBA toolbar
-2 From drop down menu select "Module"
-3 In the new VBA "Module" window that will appear paste the following code
code:

Public Sub GetDate()
Load UserForm1
UserForm1.Show
End Sub




Fifth : Assign Shortcut key to Macro
-1 Close VBA window with the X in upper right corner
-2 You should now be looking at excel worksheet
-3 On excel toolbar select "Tools"
-4 From drop down menu select "Macro"
-5 From next drop down select "Macros..."
-6 From the list of macros that appear select the name "GetDate"
-7 Select the "command button " in the same window labeled "Options"
-8 Assign the shortcut key for Macro to be "Ctrl+d"
-Press OK and exit window

IT IS NOW READY FOR USE

_________________
NOTE: (Testing performed on Win2K utilizing Office 2000. Solutions may need tweaking for other versions.)
Adieu,Nimrod
[ This Message was edited by: Nimrod on 2002-08-02 21:44 ]

Post Sat Aug 03, 2002 1:41 am 
 View user's profile Send private message AIM Address

Brian from Maui
Board Master
Board Master


Joined: 17 Feb 2002
Posts: 2380

Flag: Blank

Status: Offline

 Reply with quote  

Nimrod,

It's past midnight here, and I'm surfing this board. Came across your contribution and tried it...awesome...thanks

Brian

Post Sat Aug 03, 2002 7:10 am 
 View user's profile Send private message

TJ
Welcome to the Board


Joined: 02 Aug 2002
Posts: 3


Status: Offline

 Reply with quote  

Nimrod,

I'll try it & let you know. Thanks Much!!

Post Sat Aug 03, 2002 1:02 pm 
 View user's profile Send private message

TJ
Welcome to the Board


Joined: 02 Aug 2002
Posts: 3


Status: Offline

 Reply with quote  

Nimrod,

Just tried it and it works great. Many thanks for your help, you've saved me invaluable time.

TJ

Post Sat Aug 03, 2002 1:15 pm 
 View user's profile Send private message

Yogi Anand
MrExcel MVP


Joined: 13 Mar 2002
Posts: 5440
Location: Michigan USA

Status: Offline

 Reply with quote  

Hi Nimrod:

Thanks for your contribution ... works Great!

Regards!

Yogi

Post Sat Aug 03, 2002 4:07 pm 
 View user's profile Send private message

AC
Board Master


Joined: 22 Mar 2002
Posts: 102


Status: Offline

 Reply with quote  

Nimrod, I finally got the calendar control to load on my computer, when the form comes up should the calendar be on today’s date? Mine is not. Thanks

Post Mon Aug 05, 2002 6:11 pm 
 View user's profile Send private message
  Display posts from previous:      

MrExcel Message Board Forum Index -> Excel Questions


Forum Jump:
Jump to:  

Post new topic   Reply to topic
Page 1 of 1



Add To Favorites

 


Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB: 2.0.4 © 2001 phpBB Group

Need help posting your first question? Read how to post

Need extra help ? Couldn't get the answer you needed ? Get a free quote from our Consulting Team

Download Colo's HTML Maker utility for displaying your Excel Worksheet on the board.

Download VB HTML Maker to post your code on the board


Check out our new index to 485 Excel Articles.


Return to MrExcel Consulting

All contents Copyright 1998-2004 by MrExcel.com
If you believe information posted here is from your copyrighted source, notify us per the Terms of Use
Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.