MrExcel Message Board


Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Jan 28th, 2007, 11:47 AM   #1
imranhusain
 
Join Date: Mar 2006
Posts: 5
Default

Thats Great !

The way you explaned is terrefic.

Keep it up

Thanks
imranhusain is offline   Reply With Quote
Old Feb 7th, 2007, 12:50 AM   #2
babycody
 
babycody's Avatar
 
Join Date: Jul 2003
Location: Georgia
Posts: 1,351
Default

I was looking for something similar and found this tutorial. Uses current date, and the calendar pops up when the cell is selected. Hope this helps someone. http://www.rondebruin.nl/calendar.htm
babycody is offline   Reply With Quote
Old Aug 20th, 2007, 04:27 AM   #3
noppojp
 
Join Date: Nov 2005
Location: Tokyo
Posts: 47
Default

i love this little calendar. So do many other people i work with.

i'd like to 2nd this question.

** Is there any way to make it reflect today's date?? ***

Would love some help on this. A simple point in the right direction would do.

Regards from Tokyo
noppojp is offline   Reply With Quote
Old Aug 20th, 2007, 10:15 PM   #4
thomachr
 
Join Date: Mar 2007
Posts: 53
Default

Quote:
i love this little calendar. So do many other people i work with.

i'd like to 2nd this question.

** Is there any way to make it reflect today's date?? ***

Would love some help on this. A simple point in the right direction would do.

Regards from Tokyo
I have been looking at a number of calendar control threads and have come up with the following code which is MOSTLY doing exactly what I want:

Code:
Private Sub Calendar1_DblClick()
    ActiveCell.NumberFormat = "mm/dd/yyyy"
    ActiveCell = Calendar1
    Calendar1.Visible = False
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub
    If Not Application.Intersect(Range("C3:C5"), Target) Is Nothing Then
            Calendar1.Left = Target.Left + (Target.Width * 1.1)
            Calendar1.Top = Target.Top
        Calendar1.Visible = True
        Calendar1.Value = Date ' set calendar to today's date
    ElseIf Calendar1.Visible Then Calendar1.Visible = False
    End If
End Sub
Hope it helps!

the only think I can't get to work is I only want the calendar to appear in cells C3 and C5, but not C4. Any idea how to edit the range appropriately?
thomachr is offline   Reply With Quote
Old Aug 27th, 2007, 04:00 AM   #5
noppojp
 
Join Date: Nov 2005
Location: Tokyo
Posts: 47
Default

Hmmm. i don't know how to skip C4 in the above code.
i used the code you provided and i get an error:

Runtime Error'424': object required

----i have the following in my sheet. Maybe there's a conflict with the first one??? ----

Any ideas to get it to work?


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If IsDate(Target) Or Target.Value = "mm/dd/yy" Then GetDate
End Sub

Private Sub Calendar1_DblClick()
ActiveCell.NumberFormat = "mm/dd/yy"
ActiveCell = Calendar1
Calendar1.Visible = False
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Application.Intersect(Range("C3:C5"), Target) Is Nothing Then
Calendar1.Left = Target.Left + (Target.Width * 1.1)
Calendar1.Top = Target.Top
Calendar1.Visible = True
Calendar1.Value = Date ' set calendar to today's date
ElseIf Calendar1.Visible Then Calendar1.Visible = False
End If
End Sub
noppojp is offline   Reply With Quote
Old Aug 30th, 2007, 09:57 PM   #6
thomachr
 
Join Date: Mar 2007
Posts: 53
Default

Quote:
Hmmm. i don't know how to skip C4 in the above code.
i used the code you provided and i get an error:

Runtime Error'424': object required

----i have the following in my sheet. Maybe there's a conflict with the first one??? ----

Any ideas to get it to work?

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
 If IsDate(Target) Or Target.Value = "mm/dd/yy" Then GetDate
End Sub

Private Sub Calendar1_DblClick()
    ActiveCell.NumberFormat = "mm/dd/yy"
    ActiveCell = Calendar1
    Calendar1.Visible = False
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub
    If Not Application.Intersect(Range("C3:C5"), Target) Is Nothing Then
            Calendar1.Left = Target.Left + (Target.Width * 1.1)
            Calendar1.Top = Target.Top
        Calendar1.Visible = True
        Calendar1.Value = Date ' set calendar to today's date
    ElseIf Calendar1.Visible Then Calendar1.Visible = False
    End If
End Sub
I'm not really sure what might be causing your error. To get it to work, I had to place the code on the sheet object as opposed to a module. Also you need to add the calendar object to the sheet you want to use the calendar on: Insert/Object/Calendar Control 11.0

Sorry I can't help any more than that.[/code]
thomachr is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On

Forum Jump


All times are GMT +1. The time now is 06:33 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2009 by MrExcel Consulting.