Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have this code in an excel sheet, it brings up a calendar when I click a
cell in the range A1:A20, I can then click on a date and it populates the cell selected with that date. Problem is, I need this to apply to range C1:C20 and G1:G20, got any idea how I can add the extra ranges in? Thanks Shane Private Sub Calendar1_Click() ActiveCell.Value = CDbl(Calendar1.Value) ActiveCell.NumberFormat = "dd/mm/yyyy" 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("A1:A50"), 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 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Your code selcts on A1 to A50, not A20 as you specified in the query.
This should select on A1:A20, C1:C20 and G1:G20 If Not Application.Intersect(Range("A1:A20,C1:C20,G1:G20" ), Target) Is Nothing Then -- Ian -- "Shane" wrote in message ... I have this code in an excel sheet, it brings up a calendar when I click a cell in the range A1:A20, I can then click on a date and it populates the cell selected with that date. Problem is, I need this to apply to range C1:C20 and G1:G20, got any idea how I can add the extra ranges in? Thanks Shane Private Sub Calendar1_Click() ActiveCell.Value = CDbl(Calendar1.Value) ActiveCell.NumberFormat = "dd/mm/yyyy" 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("A1:A50"), 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 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank you very much
Shane "Ian" wrote: Your code selcts on A1 to A50, not A20 as you specified in the query. This should select on A1:A20, C1:C20 and G1:G20 If Not Application.Intersect(Range("A1:A20,C1:C20,G1:G20" ), Target) Is Nothing Then -- Ian -- "Shane" wrote in message ... I have this code in an excel sheet, it brings up a calendar when I click a cell in the range A1:A20, I can then click on a date and it populates the cell selected with that date. Problem is, I need this to apply to range C1:C20 and G1:G20, got any idea how I can add the extra ranges in? Thanks Shane Private Sub Calendar1_Click() ActiveCell.Value = CDbl(Calendar1.Value) ActiveCell.NumberFormat = "dd/mm/yyyy" 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("A1:A50"), 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to insert date using a pop up calendar control in a cell i | Excel Discussion (Misc queries) | |||
calendar control 10.0 | Excel Discussion (Misc queries) | |||
Calendar Control 11.0 | Excel Discussion (Misc queries) | |||
calendar control - formatting | Excel Discussion (Misc queries) | |||
how do you use the ActiveX Calendar control in an Excel Worksheet. | Excel Worksheet Functions |