PC Review


Reply
Thread Tools Rate Thread

Date & Time Picker Control 6.0

 
 
JAD
Guest
Posts: n/a
 
      9th Sep 2008
I would like for the Date & Time Picker Control 6.0 to appear whenever a user
double clicks on a cell that requires a date. As an example, if the user is
in the worksheet named "WS1" and double clicks on cell "B11", the ActiveX
control will appear, allow you to select a date and then enter that date into
cell B11. Once entered, the Date & Time Picker Control 6.0 will disappear.
Any help would be appreciated. Thank You, JAD
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      10th Sep 2008
Use a worksheet changge function which will make the control visible when you
need to make an entry and then make it invisible after the entry is made.

"JAD" wrote:

> I would like for the Date & Time Picker Control 6.0 to appear whenever a user
> double clicks on a cell that requires a date. As an example, if the user is
> in the worksheet named "WS1" and double clicks on cell "B11", the ActiveX
> control will appear, allow you to select a date and then enter that date into
> cell B11. Once entered, the Date & Time Picker Control 6.0 will disappear.
> Any help would be appreciated. Thank You, JAD

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      10th Sep 2008
Add the Date & Time Picker control to the worksheet's Control Toolbox (I am
not using a UserForm for this), then place it anywhere on worksheet WS1.
Then right click WS1's tab to go to the code window for that worksheet and
copy paste this code into that code window...

'***************** START OF CODE *****************
Dim CurrentDTPickerCell As Range

Private Sub DTPicker1_CloseUp()
CurrentDTPickerCell.Value = DTPicker1.Value
DTPicker1.Visible = False
End Sub

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Not Intersect(Target, Range("A10,B11,C12")) Is Nothing Then
Cancel = True
Set CurrentDTPickerCell = Target
DTPicker1.Visible = True
DTPicker1.Top = Target.Top
DTPicker1.Left = Target.Left + Target.Width + 1
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A10,B11,C12")) Is Nothing Then
If DTPicker1.Visible Then DTPicker1.Visible = False
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If DTPicker1.Visible Then DTPicker1.Visible = False
End Sub
'***************** END OF CODE *****************

Simply change the range of values that this functionality should apply to in
both the BeforeDoubleClick and the Change events and you are done... go to
WK1 and start to use it. As set up, double clicking A10, B11 or C12 will
bring up the date picker control next to the cell allowing you to select a
date from there.

--
Rick (MVP - Excel)


"JAD" <(E-Mail Removed)> wrote in message
news:893C8E5B-C346-48E8-9598-(E-Mail Removed)...
>I would like for the Date & Time Picker Control 6.0 to appear whenever a
>user
> double clicks on a cell that requires a date. As an example, if the user
> is
> in the worksheet named "WS1" and double clicks on cell "B11", the ActiveX
> control will appear, allow you to select a date and then enter that date
> into
> cell B11. Once entered, the Date & Time Picker Control 6.0 will disappear.
> Any help would be appreciated. Thank You, JAD


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting current date on date/time picker control =?Utf-8?B?RG91Z00=?= Microsoft Access VBA Modules 1 19th Jul 2005 07:07 PM
I am trying to use the Microsoft Date and Time Picker control and I am getting the following error "an error occured in a call to the windows date and time picker control" in access 2000 Ralph Malph Microsoft Access Forms 0 25th Oct 2004 07:00 PM
MS Date and Time Picker Control defaults to today's date =?Utf-8?B?UmF2aQ==?= Microsoft Outlook VBA Programming 1 22nd Jan 2004 02:48 PM
Problem with Date & Time Picker control in a Tab Control form Mystery Microsoft Access Form Coding 0 2nd Aug 2003 11:43 AM
Problem with Date & Time Picker control in a Tab Control form Mystery Microsoft Access Forms 0 2nd Aug 2003 11:43 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:10 AM.