Date picker on a specific cell Excel 2010

Miguelluis

New Member
Joined
Jan 29, 2013
Messages
45
Hi

I'm trying to add a date picker to a sheet that will run when a user selects a cell in column A. I got as far as being able to run it any where on my workbook but I am having problems containing it to column A nor can I figure out how to make the date picker appear when I select a cell in column A.

With a youtube videao I created a form and a module and the code for this is below, Is any one able to help me run this when a user selects a cell in column A?

Form code:


Private Sub cmdClose_Click()
Unload Me
End Sub




Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
On Error Resume Next
Dim cell As Object
For Each cell In Selection.Cells
cell.Value = Me.MonthView1.Value
Next cell
Unload Me
End Sub




Private Sub UserForm_Initialize()
If IsDate(ActiveCell.Value) Then
Me.MonthView1.Value = ActiveCell.Value
End If
End Sub
------------------------------------------------------------------------------

Workbook code:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.OnKey "+^{C}"
Application.CommandBars("cell").Controls("Insert Date").Delete
End Sub


Private Sub Workbook_Open()
On Error Resume Next
Dim newcontrol As CommandBarControl
Application.OnKey "+^{C}", "Module1.OpenCalendar"
Application.CommandBars("cell").Controls("Insert Date").Delete
Set newcontrol = Application.CommandBars("Cell").Controls.Add
With newcontrol
.Caption = "Insert Date"
.OnAction = "Module1.OpenCalendar"
.BeginGroup = True
End With
End Sub
------------------------------------------------------------------



Module Code:


Sub OpenCalendar()
frmcalendar.Show
End Sub

Thank you
Miguel
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,214,516
Messages
6,119,978
Members
448,934
Latest member
audette89

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