Drop-Down Box with a Calendar

TJ

New Member
Joined
Aug 1, 2002
Messages
3
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?
 
Found a reference to my problem elsewhere, I declared
"Public calendar1 as calendar"

The new code posted here brings up the calendar on a double -click, BUT there is still an error on the line with Calendar1 "Object variable or with block not set"

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Dim Cell1 As String, Cell2 As String
    Cell1 = "$F$20" 
    Cell2 = "$F$25"  
    If Target.Address = Cell1 Or Target.Address = Cell2 Then
        Load UserForm2
        UserForm2.Show
        ActiveCell.Value = Calendar1.Value  '  <<-- Error
        UserForm2.Hide
        Unload UserForm2
    End If
    
End Sub

Thanks in advance
 
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I haven't got a "calendar control" but I have used the "Microsoft Date and Time Picker Control 6.0 (SP4)" if this helps anyone.
Cheers Nimrod
 
Upvote 0
Re: Calander Problems

nanefy said:
Hi,

I have used the calander function below and it works perfectly. The only problem is that it doesnt, by default, bring up the current month. I implemented this in September and now in October it doesnt bring October up as the default date. Can anyone tell me how to do this?

Cheers!

Love this shortcut to calender but has anyone any ideas on nanefy's problem above???

thanks
 
Upvote 0
Try to add this code:

Private Sub UserForm_Activate()
Today = Now
Calendar1.Value = DateValue(Today)
End Sub
 
Upvote 0
D4VE said:
Try to add this code:

Private Sub UserForm_Activate()
Today = Now
Calendar1.Value = DateValue(Today)
End Sub

sorry - where would you put this in the original code? i'm not the best at VB..
 
Upvote 0
The step to put the calander on the user form (as described by Nimrod), has a problem when you want to distribute the spreadsheet to other users. You have to perform the steps shown below on each system!!!! I am expected to make my application available to about 100 unique users>

Is there another way besides the step below?

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"
 
Upvote 0
WOW!

This is amazing! Thanks for the great instructions. They were perfect! (Except for my spelling) :LOL:
 
Upvote 0
Thanks for sharing your knowledge.
I have been looking for this function for sometime it made my sheet more user friendly.

Robert
 
Upvote 0
This is an awesome thread.
Anyone have input on how to format the date without using the cell format controls to guide the parameters of the date field?

I am looking at how to properly format the date into a variable to pass to SQL.

Gracias
 
Upvote 0

Forum statistics

Threads
1,214,798
Messages
6,121,635
Members
449,043
Latest member
farhansadik

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top