Hi, all
I have downloaded the following VBA script to be able to select a date from a calendar, rather than having to type in a date manually.
At present, the calendar appears when the shortcut key SHIFT+CTRL+C is selected, or from the right-click drop down menu.
I would like the calendar to appear in every cell where below where the text "date" occurs in the first three rows of the column.
E.g., if I have the text "Commencement date" in cell A3, I would like all cells below A3, when selected, to popup this calendar; similarly if I had the text
"Date of termination" in C1, the same should happen to all cells below C1.
What code modification would I require to enable this, please?
I look forward to your answers.
My thanks,
PatrickW
I have downloaded the following VBA script to be able to select a date from a calendar, rather than having to type in a date manually.
PHP:
' ===================================================
' Code by Martin Green eMail martin@fontstuff.com
' Visit my Office Tips web site at www.fontstuff.com
' ===================================================
Private Sub Workbook_Open()
Dim NewControl As CommandBarControl
' Assign shortcut to display calendar on SHIFT+CTRL+C
Application.OnKey "+^{C}", "Module1.OpenCalendar"
' Add item to shortcut menu on open
On Error Resume Next
Application.CommandBars("Cell").Controls("Insert Date").Delete
On Error GoTo 0
Set NewControl = Application.CommandBars("Cell").Controls.Add
With NewControl
.Caption = "Insert Date"
.OnAction = "Module1.OpenCalendar"
.BeginGroup = True
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
' Delete item from shortcut menu on close
On Error Resume Next
Application.CommandBars("Cell").Controls("Insert Date").Delete
End Sub
At present, the calendar appears when the shortcut key SHIFT+CTRL+C is selected, or from the right-click drop down menu.
I would like the calendar to appear in every cell where below where the text "date" occurs in the first three rows of the column.
E.g., if I have the text "Commencement date" in cell A3, I would like all cells below A3, when selected, to popup this calendar; similarly if I had the text
"Date of termination" in C1, the same should happen to all cells below C1.
What code modification would I require to enable this, please?
I look forward to your answers.
My thanks,
PatrickW