Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Date picker control

I have added two date picker controls to a worksheet.

On one control:
I would like to default to today's date whenever the workbook is opened.

On the other control:
I would like to default the date to today + 2 weeks.

How do i set a default value for these controls?


-- Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Date picker control

Open VBA Editor ans select This Workbook in the project browser
Something similar to this in a workbook open event.

Private Sub Workbook_Open() 'Must be this sub name
Dim TodaysDate As Date
Dim TodayFortnightDate As Date
Sheets("ExcelControls").Select 'Use your sheet name
TodaysDate = Date
TodayFortnightDate = Date + 14
Sheets("ExcelControls").CommandButton1.Caption = Format _
(TodaysDate, "dd/mm/yyyy")
Sheets("ExcelControls").CommandButton2.Caption = Format _
(TodayFortnightDate , "dd/mm/yyyy")
End Sub




"GeraldM" wrote:

I have added two date picker controls to a worksheet.

On one control:
I would like to default to today's date whenever the workbook is opened.

On the other control:
I would like to default the date to today + 2 weeks.

How do i set a default value for these controls?


-- Thanks in advance

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Date picker control

I have had another read of your request and now I am not sure whether it is
the default value to process that you want to change or the caption. If it is
the value then basically the same but substitue caption with value and you
may be able to leave the format function out. However, you cannot set a value
for a control button and I don't know what sort of control you have so my
example is for a ComboBox
eg. Sheets("ExcelControls").ComboBox1.Value = TodaysDate


"OssieMac" wrote:

Open VBA Editor ans select This Workbook in the project browser
Something similar to this in a workbook open event.

Private Sub Workbook_Open() 'Must be this sub name
Dim TodaysDate As Date
Dim TodayFortnightDate As Date
Sheets("ExcelControls").Select 'Use your sheet name
TodaysDate = Date
TodayFortnightDate = Date + 14
Sheets("ExcelControls").CommandButton1.Caption = Format _
(TodaysDate, "dd/mm/yyyy")
Sheets("ExcelControls").CommandButton2.Caption = Format _
(TodayFortnightDate , "dd/mm/yyyy")
End Sub




"GeraldM" wrote:

I have added two date picker controls to a worksheet.

On one control:
I would like to default to today's date whenever the workbook is opened.

On the other control:
I would like to default the date to today + 2 weeks.

How do i set a default value for these controls?


-- Thanks in advance

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date picker control Ricardo F Excel Discussion (Misc queries) 2 October 20th 08 03:44 PM
Custom Date Picker Control Lucas Swanson Excel Programming 0 April 21st 06 04:59 PM
Custom Date Picker Control Lucas Swanson Excel Programming 0 April 21st 06 04:13 PM
date time picker control MacroCharlie Excel Programming 0 November 16th 05 04:01 PM
Date and Time Picker Control Andy T Excel Discussion (Misc queries) 0 January 6th 05 04:09 PM


All times are GMT +1. The time now is 02:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"