PDA

View Full Version : Solved: Calendar Control 11 - Open on today



Phelony
06-09-2011, 02:50 AM
Hi Guys

I must admit that I'm asking out of sheer annoyance. I know there are hundreds of references to calendar control on the web and I've looked through them and those on this forum, but none seem to be providing a solution. :dunno

I've got a calendar control embedded into a worksheet that I simply want to default to todays date when the workbook opens, however, this is proving to be extremely difficult. There are loads of available solutions if I make this into a userform, but I really would rather that this stayed as an object on the worksheet itself.

So far, I've got:

'automatically set the date to todays date on opening the workbook

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveCell = Sheets("console").Range("A1")
ActiveCell.Value = Date

If IsDate(ActiveCell.Value) Then
Calendar1.Value = ActiveCell.Value
Else
Calendar1.Value = Date
End If

Sheets("console").Range("A1").ClearContents


End Sub

This worked when I first wrote it, but now it seems to be being obnoxious and refuses to work. :banghead: :banghead: :banghead:

Any ideas? :help

Thanks

Phel

EDIT - I'm working in 2003....don't ask...

p45cal
06-09-2011, 05:21 AM
calendar control embedded into a worksheet that I simply want to default to todays date when the workbook opens In the ThisWorkbook code module:
Private Sub Workbook_Open()
Sheets("NameOfSheetTheCalendarControIsOn").Calendar1.Value = Date
End Sub

Phelony
06-09-2011, 05:24 AM
That's annoyingly obvious...darn...

Thank you so much, couldn't see the wood for the trees there! :bug:

:beerchug:

Phel