View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark Dullingham Mark Dullingham is offline
external usenet poster
 
Posts: 92
Default <HELPModify calender code for a combo box

I have the following code on a page to pop up a calender when 1 of 2 cells
are selected and then the chosen date fills the active cell and disappears
when a cell outside the range is selected.
My question is - is it possible to modify this code to do the same with a
combo box I have on another page. I have tried substituting references to the
calender object with the combo box name but there are some obvious other
things that need changing and I am a VBA dunce. The code is

Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)
ActiveCell.NumberFormat = "dd/mm/yy"
ActiveCell.Select
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Not Application.Intersect(Range("G14,G17"), Target) Is Nothing Then
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
Calendar1.Top = Target.Top + Target.Height
Calendar1.Visible = True
' select Today's date in the Calendar
Calendar1.Value = Date
ElseIf Calendar1.Visible Then Calendar1.Visible = False
End If
End Sub

and the current code for the combo box is

Private Sub ComboBox1_Change()

End Sub

Can anyone help
gratitude in vast quantities in advance