View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Adding Calendar to Worksheet

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 University’s 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