I am using monthview control as calander in separate userform called dateform.
I have multiple date fields on excel vba userform called Update_Entries_New hence I cannot directly reference date clicked on monthview calander like below (though direct referencing like below works perfectly fine).
Update_Entries_New.Invoice_date.Value = DateClicked
To solve the issue, I am generating Update_Entries_New.Invoice_date.Value dynamically to access monthview calander in all date fields in all userforms I have in project.
When I use dynamically created textbox name (picked from excel sheet cell) date clicked on monthview calander doesn't gets updated on textbox value from where calander got populated. any clue why this is happening.
my current code
Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
Dim test
'dynamically referencing of "Update_Entries_New.Invoice_date.Value" picked from 'Sheets("Data").Range("m2").Value' doesn't update the value on userform textbox
controlname = Sheets("Data").Range("m2").Value
controlname = DateClicked
'using textbox name directly works fine with below code
Update_Entries_New.Invoice_date.Value = DateClicked
Unload dateform
End Sub