View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\)[_469_] Rick Rothstein \(MVP - VB\)[_469_] is offline
external usenet poster
 
Posts: 1
Default Adding Calendar to Worksheet

If you do not already have the Visual Basic toolbar displayed, click
View/Toolbars from Excel's menu bar and select it from the list of Toolbars
available. Next, click its Control Toolbox icon (looks like a wrench and
hammer crossing each other). Next, click the More Controls icon on the
Control Toolbox (also looks like a wrench and hammer crossing each other)
and select Microsoft Month View Control from the list, then click on the
worksheet to place it. Move it near the cell you want it to become visible
for when selected. Right click the MonthView Control and select Properties
from the popup list that appears. Set the Visible property to False. Also,
you can control the size of the MonthView Control by changing its Font Size
(click Font, then the ellipsis button). You can now dismiss the Properties
window and double click the MonthView Control to get into the VBA editor.
Copy/Paste this code in the code window that appeared...

Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
Range("H5").Value = MonthView1.Value
End Sub

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

Note: Change the "H5" and "$H$5" example values to the cell address you want
the functionality for (the addresses must be the same and the one in the
SelectionChange event *must* be an absolute address. Go back to the
worksheet and turn off Design Mode and dismiss the Control Toolbox (click
their icons on the Visual Basic toolbar). That's it... it should work
automatically from here on out.

Rick


"tracktor" wrote in message
...
I want to add a calender to my worksheet that when a user selects a
specific
cell the calender will come up, the user can select a date, and it will
fill
the cell with that date, then when the user goes to the next cell the
calender dissapears, but the date stays in the specific cell.