View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
tracktor tracktor is offline
external usenet poster
 
Posts: 17
Default Adding Calendar to Worksheet

I have more than one place to enter a date, so I need a calendar to show up
in those places when the user selects that cell. I also have one of them that
I want the cell to be emptied based on the value of another cell. I'm sure
this could be done. It's obvious I don't know how to code.

For right now when a user selects cells H2, H59, and H213, I need a calendar
to pop up so they can select a date, and as soon as they do I need the
calendar to dissapear. All three of the dates are different. The date in cell
H213 needs to be emptied based on the value of another cell.


"Gord Dibben" wrote:

You cannot have two events of the same type in the same worksheet module.

Looks like you are trying for too many Selection_Changes.

Also looks like too many Worksheet_Changes


Gord Dibben MS Excel MVP


On Sat, 17 May 2008 14:55:01 -0700, tracktor
wrote:

As far as I know my copy of Microsoft Office is legitamate, I bought it form
the Universitys bookstore, and it is Microsoft Professional Edition 2003,
and it says €śAcademic Price, Not for use in a commercial environment.€ť As far
as I know it is a full blown version that was sold at a reduced price for
students.

I put the Calendar Control 11..0 and it works fine on an empty worksheet.
But when I put it on the worksheet with the other code that you gave me for
€śemptying the contents of a cell based on the value of another cell€ť post. I
get a message that says €ś Compile error: Ambiguous name detected:
Worksheet_SelectionChange

This is exactly what is pasted in the View Code window before I pasted the
code for the calendar:

'********************** START OF CODE **********************

Dim PreviousValue As String

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$H$233" Then
If Range("H233").Value = "See page 10 Additional Terms" And
Range("H235").Value = "0" And _
PreviousValue = "Enter Specific COE Date" Then Range("H235").Value = ""
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$H$233" Then PreviousValue = Target.Value
End Sub

'*********************** END OF CODE ***********************

This is what it looks like after I pasted the code for the calendar.

'********************** START OF CODE **********************

Dim PreviousValue As String

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$H$233" Then
If Range("H233").Value = "See page 10 Additional Terms" And
Range("H235").Value = "0" And _
PreviousValue = "Enter Specific COE Date" Then Range("H235").Value = ""
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$H$233" Then PreviousValue = Target.Value
End Sub

'*********************** END OF CODE ***********************
Private Sub Calendar1_Click()
Range("H2").Value = Calendar1.Value
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Calendar1.Visible = Target.Address = "$H$2"
End Sub


"Rick Rothstein (MVP - VB)" wrote:

... (except for the Font object sizing one... this control has separate
Font objects for its Title and Day text...

Just noticed... it also has a font object for the Grid text also.

Rick