Diving_Dan
Board Regular
- Joined
- Oct 20, 2019
- Messages
- 161
Hi all,
I'm quite new here and new to vba. I have a worksheet that opens a pop up calendar when I click on a certain cell. When I then click on a date on that pop up it puts the date into that particular cell and then the calendar closes. This is all good and working.
Is there a way that when the calendar closes a certain cell is activated/chosen. My calendar is linked to cell H2. When I click on a date on the pop up H2 is populated with that date and the calendar closes. What I would like is for A2 to be chosen rather than H2 remaining the chosen cell.
Is this possible?
Thanks in advance.
This is the current coding I have for the form
This is the code I have within the module for my calendar to pop up.
And this is the code I have within the sheet
I'm quite new here and new to vba. I have a worksheet that opens a pop up calendar when I click on a certain cell. When I then click on a date on that pop up it puts the date into that particular cell and then the calendar closes. This is all good and working.
Is there a way that when the calendar closes a certain cell is activated/chosen. My calendar is linked to cell H2. When I click on a date on the pop up H2 is populated with that date and the calendar closes. What I would like is for A2 to be chosen rather than H2 remaining the chosen cell.
Is this possible?
Thanks in advance.
This is the current coding I have for the form
Code:
Private Sub cmdClose_Click() Unload Me
End Sub
Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
On Error Resume Next
ActiveCell.Value = DateClicked
Unload Me
End Sub
Private Sub UserForm_Initialize()
If IsDate(ActiveCell.Value) Then
Me.MonthView1.Value = ActiveCell.Value
End If
End Sub
Code:
Sub OpenCalendar() frmCalendar.Show
End Sub
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If (Target.Count = 1) Then
If Not Intersect(Target, Range("H2")) Is Nothing Then frmCalendar.Show
End If
End Sub