Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Date & Time | New Users to Excel | |||
Hyperlinks using R[1]C[1] and offset function in its cell referenc | Excel Worksheet Functions | |||
Conversion | Excel Worksheet Functions | |||
Calendar date function | Excel Discussion (Misc queries) | |||
HOW CAN I GET OFFICE 2003 EXCEL BASIC TO NEST FUNCTIONS LIKE EXCE. | Excel Worksheet Functions |