Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Dawn
 
Posts: n/a
Default Help Using Calendar Function

Hi, I'm using the calendar function so when you click on a calendar icon it
brings up the calendar and when you select the correct date it inserts it
into the relevant cell I want. My trouble is that when you load the calendar
the date it opens at is not "Todays" date. I would like the calendar when
clicked to open to be on todays date - how do I do this?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Kevin B
 
Posts: n/a
Default Help Using Calendar Function

I'm making an assumption that you're using the date picker ActiveX control.
If so, you can place the following code in your workbooks module for the
OnOpen event. Modify the Date Picker name to refernce whatever name you've
assigned to it. If your unsure, open the Control Toolbox tool bar, click the
Design button and the right click on your calendar control and select
properties.

Private Sub Workbook_Open()

Dim dtPicker As dtPicker

Set dtPicker = ActiveWorkbook.Sheets("Sheet1").DTPicker1

dtPicker.Month = Month(Date)
dtPicker.Day = Day(Date)
dtPicker.Year = Year(Date)


End Sub

--
Kevin Backmann


"Dawn" wrote:

Hi, I'm using the calendar function so when you click on a calendar icon it
brings up the calendar and when you select the correct date it inserts it
into the relevant cell I want. My trouble is that when you load the calendar
the date it opens at is not "Todays" date. I would like the calendar when
clicked to open to be on todays date - how do I do this?

  #3   Report Post  
Posted to microsoft.public.excel.misc
Dawn
 
Posts: n/a
Default Help Using Calendar Function

Thanks Kevin, I'll give it a go - DAWN

"Kevin B" wrote:

I'm making an assumption that you're using the date picker ActiveX control.
If so, you can place the following code in your workbooks module for the
OnOpen event. Modify the Date Picker name to refernce whatever name you've
assigned to it. If your unsure, open the Control Toolbox tool bar, click the
Design button and the right click on your calendar control and select
properties.

Private Sub Workbook_Open()

Dim dtPicker As dtPicker

Set dtPicker = ActiveWorkbook.Sheets("Sheet1").DTPicker1

dtPicker.Month = Month(Date)
dtPicker.Day = Day(Date)
dtPicker.Year = Year(Date)


End Sub

--
Kevin Backmann


"Dawn" wrote:

Hi, I'm using the calendar function so when you click on a calendar icon it
brings up the calendar and when you select the correct date it inserts it
into the relevant cell I want. My trouble is that when you load the calendar
the date it opens at is not "Todays" date. I would like the calendar when
clicked to open to be on todays date - how do I do this?

  #4   Report Post  
Posted to microsoft.public.excel.misc
Dawn
 
Posts: n/a
Default Help Using Calendar Function

Kevin,

I've tried it, but to be honest I dont know what I am doing.

My calendar which I have an icon on the spreadsheet when pressed it runs a
macro called "show it"

Sub ShowIt()

UserForm2.Show
End Sub

This then brings up a calendar and when I click on the date I want the code
attached to the Form does the below.

End Sub


Private Sub Calendar1_Click()
Range("B7") = Calendar1.Value

End Sub

Private Sub UserForm2_Activate()
Me.Calendar1.Value = Date
End Sub

Private Sub UserForm_Click()

End Sub


This then puts the date I have chosen in my spreadsheet. Where do I put the
code you have given below.

Thanks DAWN
"Kevin B" wrote:

I'm making an assumption that you're using the date picker ActiveX control.
If so, you can place the following code in your workbooks module for the
OnOpen event. Modify the Date Picker name to refernce whatever name you've
assigned to it. If your unsure, open the Control Toolbox tool bar, click the
Design button and the right click on your calendar control and select
properties.

Private Sub Workbook_Open()

Dim dtPicker As dtPicker

Set dtPicker = ActiveWorkbook.Sheets("Sheet1").DTPicker1

dtPicker.Month = Month(Date)
dtPicker.Day = Day(Date)
dtPicker.Year = Year(Date)


End Sub

--
Kevin Backmann


"Dawn" wrote:

Hi, I'm using the calendar function so when you click on a calendar icon it
brings up the calendar and when you select the correct date it inserts it
into the relevant cell I want. My trouble is that when you load the calendar
the date it opens at is not "Todays" date. I would like the calendar when
clicked to open to be on todays date - how do I do this?

  #5   Report Post  
Posted to microsoft.public.excel.misc
Kevin B
 
Posts: n/a
Default Help Using Calendar Function

Now that I've had some sleep, it was around 1:00 AM when I read your
question, it seems to me that you have standard calendar control on your form.

If you put this in your form's module, for the Initialize event, it well set
the standard calendar control to the current date.

You can use DateSerial(Year, Month, Day) to set it any date you wish, with
the year, month and day being entered as integers.

Hope this helps, if not post again
Private Sub UserForm_Initialize()

Me.Calendar1.Value = Date


End Sub

--
Kevin Backmann


"Dawn" wrote:

Kevin,

I've tried it, but to be honest I dont know what I am doing.

My calendar which I have an icon on the spreadsheet when pressed it runs a
macro called "show it"

Sub ShowIt()

UserForm2.Show
End Sub

This then brings up a calendar and when I click on the date I want the code
attached to the Form does the below.

End Sub


Private Sub Calendar1_Click()
Range("B7") = Calendar1.Value

End Sub

Private Sub UserForm2_Activate()
Me.Calendar1.Value = Date
End Sub

Private Sub UserForm_Click()

End Sub


This then puts the date I have chosen in my spreadsheet. Where do I put the
code you have given below.

Thanks DAWN
"Kevin B" wrote:

I'm making an assumption that you're using the date picker ActiveX control.
If so, you can place the following code in your workbooks module for the
OnOpen event. Modify the Date Picker name to refernce whatever name you've
assigned to it. If your unsure, open the Control Toolbox tool bar, click the
Design button and the right click on your calendar control and select
properties.

Private Sub Workbook_Open()

Dim dtPicker As dtPicker

Set dtPicker = ActiveWorkbook.Sheets("Sheet1").DTPicker1

dtPicker.Month = Month(Date)
dtPicker.Day = Day(Date)
dtPicker.Year = Year(Date)


End Sub

--
Kevin Backmann


"Dawn" wrote:

Hi, I'm using the calendar function so when you click on a calendar icon it
brings up the calendar and when you select the correct date it inserts it
into the relevant cell I want. My trouble is that when you load the calendar
the date it opens at is not "Todays" date. I would like the calendar when
clicked to open to be on todays date - how do I do this?



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 & Time mully New Users to Excel 4 May 23rd 05 11:56 AM
Hyperlinks using R[1]C[1] and offset function in its cell referenc Elijah-Dadda Excel Worksheet Functions 0 March 5th 05 03:31 AM
Conversion SVC Excel Worksheet Functions 9 February 28th 05 02:29 PM
Calendar date function John Excel Discussion (Misc queries) 1 January 7th 05 06:08 PM
HOW CAN I GET OFFICE 2003 EXCEL BASIC TO NEST FUNCTIONS LIKE EXCE. Robert AS Excel Worksheet Functions 4 December 2nd 04 10:49 AM


All times are GMT +1. The time now is 11:09 PM.

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

About Us

"It's about Microsoft Excel"