mikeellinas
New Member
- Joined
- Nov 7, 2017
- Messages
- 25
Hi. First post here. I tried searching, but did not see anything (I may not have used the proper search terms).
I am new to the VBA game. I have a macro using the MonthView form. It is triggered by a keyboard shortcut:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.OnKey "+^{C}"
Application.CommandBars("Cell").Controls("Insert Date").Delete
End Sub
Private Sub Workbook_Open()
On Error Resume Next
Dim NewControl As CommandBarControl
Application.OnKey "+^{C}", "Module2.OpenCalendar"
Application.CommandBars("Cell").Controls("Insert Date").Delete
Set NewControl = Application.CommandBars("Cell").Controls.Add
With NewControl
.Caption = "Insert Date"
.OnAction = "Module2.OpenCalendar"
.BeginGroup = True
End With
End Sub
I would like to trigger the macro when clicking any cell in the range C8:C13 or C15:C20. I would even be okay if it was done when clicking anything in C8:C20. Can anyone help me with the code for this adjustment?
EDIT: I forgot to mention. Using Excel 2010 if that matters
I am new to the VBA game. I have a macro using the MonthView form. It is triggered by a keyboard shortcut:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.OnKey "+^{C}"
Application.CommandBars("Cell").Controls("Insert Date").Delete
End Sub
Private Sub Workbook_Open()
On Error Resume Next
Dim NewControl As CommandBarControl
Application.OnKey "+^{C}", "Module2.OpenCalendar"
Application.CommandBars("Cell").Controls("Insert Date").Delete
Set NewControl = Application.CommandBars("Cell").Controls.Add
With NewControl
.Caption = "Insert Date"
.OnAction = "Module2.OpenCalendar"
.BeginGroup = True
End With
End Sub
I would like to trigger the macro when clicking any cell in the range C8:C13 or C15:C20. I would even be okay if it was done when clicking anything in C8:C20. Can anyone help me with the code for this adjustment?
EDIT: I forgot to mention. Using Excel 2010 if that matters
Last edited by a moderator: