Customisable drop down calender

excel_savvy

New Member
Joined
Dec 20, 2013
Messages
1
Hi, I am trying to create a cutomisable drop down calender.

The only option i have found so far is "microsoft date & time picker control 6.0 (sp4)" active-x control macro.

However so far I cannot seem to customise the dates it allows me to select.

I need it to only allow every second Wednesday to be selectable & if any other day is selected for a customisable error message to pop up.

If anyone can help with the code that needs to sit behind this it would be appreciated.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
that can be done with vba code


when you say every second wednesday, when is the first wednesday?
 
Upvote 0
here is a starting point

put a calendar control on your worksheet

put this in the worksheet code

click around the calendar control and have a look at the popups

i put in code to ignore click on the 10th day of any month

you probably want to use the BeforeUpdate event handler to put your code

Code:
Private Sub Calendar1_AfterUpdate()
    MsgBox "value" & vbTab & Calendar1.Value & vbCrLf & _
           "day" & vbTab & Calendar1.Day & vbCrLf & _
           "month" & vbTab & Calendar1.Month & vbCrLf & _
           "year" & vbTab & Calendar1.Year, , "Calendar1_AfterUpdate"
    
End Sub


Private Sub Calendar1_BeforeUpdate(Cancel As Integer)
    MsgBox "value" & vbTab & Calendar1.Value & vbCrLf & _
           "day" & vbTab & Calendar1.Day & vbCrLf & _
           "month" & vbTab & Calendar1.Month & vbCrLf & _
           "year" & vbTab & Calendar1.Year, , "Calendar1_BeforeUpdate"
    
    If Calendar1.Day = 10 Then Cancel = 1


End Sub


Private Sub Calendar1_Click()
    MsgBox "Calendar1_Click"
End Sub


Private Sub Calendar1_KeyDown(KeyCode As Integer, ByVal Shift As Integer)
    MsgBox "Calendar1_KeyDown"
End Sub


Private Sub Calendar1_KeyPress(KeyAscii As Integer)
    MsgBox "Calendar1_KeyPress"
End Sub


Private Sub Calendar1_KeyUp(KeyCode As Integer, ByVal Shift As Integer)
    MsgBox "Calendar1_KeyUp"
End Sub


Private Sub Calendar1_NewMonth()
    MsgBox "Calendar1_NewMonth"
End Sub


Private Sub Calendar1_NewYear()
    MsgBox "Calendar1_NewYear"
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,569
Messages
6,131,466
Members
449,652
Latest member
ylsteve

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