Is there a way to add the DateTimePicker control to a cell.

  • Thread starter Thread starter Muxer
  • Start date Start date
M

Muxer

I would like to know a way that when a user selects certain cell, a
DTPicker control or any other date control drop down. User could select
any date from there.

Any help would be apreciated.
 
Here is one way
Add a userform and insert the monthview control or other control you like.
I'm not a big fan of the dtpicker as I always seem to get corruption
problems when I use the control.

If the control works for you then you can insert a dtpicker over the top of
a cell or anywhere on the sheet and add the following code to it:
Private Sub DTPicker1_Change()
[A1].Value = DTPicker1.Value 'change A1 to whatever cell you want
End Sub
I haven't figure out how to make the object not print so if you do, let me
know how you did it

If you want to use the monthview control displayed on a form, then try this:
create a form and insert the monthview control on it
add the following code to the form
Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
ActiveCell.Value = MonthView1.Value
End Sub

then add the following to the code for the sheet the user will click the
cell on
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Then UserForm1.Show 'change A1 to whatever cell
you are setting the date
End Sub

These may not be exactly what you want but it's a start. Note I used the
default names for the form and controls so change them as needed

Paul D
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top