Hoping someone can help.
I have a VBA User form with a text box named: txtDate
I would like my Monthview Calendar (already built) named: frmCalendar to open when the user enters the (cursor into the) text box.
I would then like the user to be able to pick a date from the Monthview Calender which will transfer to the textbox (txtDate) – then unload/close.
Note. I have a separate Command button on the form which I will use to enter all the information on the userform.
I have seen this question asked online a few times but none of the answers/solutions are working for me. I’m hoping someone can help me out with the correct VBA code for this one including the relevant modules to place the codes in .
The code I’m currently using only opens the calendar after I have entered a value in the text box then delete it – then it opens the calendar but does not allow a date to be transferred to the text box. Code in the Userform module.
'
Sub SetmeRec()
Dim DateCus As Range
On Error GoTo SetmeRec_Error
Set DateCus = Sheet3.Cells(Rows.Count, 6).End(xlUp).Offset(0, -1)
DateCus = frmCalendar.Val(Me.txtONum)
DateCus.Offset(0, -1) = Me.cboReceiving
DateCus.Offset(0, -2) = Format(Me.txtDate.Value, "dd/mm/yyyy")
On Error GoTo 0
Exit Sub
SetmeRec_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure SetmeRec of Form frmReceiving"
End Sub
As usual, any help is greatly appreciated.
Many thanks in advance
I have a VBA User form with a text box named: txtDate
I would like my Monthview Calendar (already built) named: frmCalendar to open when the user enters the (cursor into the) text box.
I would then like the user to be able to pick a date from the Monthview Calender which will transfer to the textbox (txtDate) – then unload/close.
Note. I have a separate Command button on the form which I will use to enter all the information on the userform.
I have seen this question asked online a few times but none of the answers/solutions are working for me. I’m hoping someone can help me out with the correct VBA code for this one including the relevant modules to place the codes in .
The code I’m currently using only opens the calendar after I have entered a value in the text box then delete it – then it opens the calendar but does not allow a date to be transferred to the text box. Code in the Userform module.
'
Sub SetmeRec()
Dim DateCus As Range
On Error GoTo SetmeRec_Error
Set DateCus = Sheet3.Cells(Rows.Count, 6).End(xlUp).Offset(0, -1)
DateCus = frmCalendar.Val(Me.txtONum)
DateCus.Offset(0, -1) = Me.cboReceiving
DateCus.Offset(0, -2) = Format(Me.txtDate.Value, "dd/mm/yyyy")
On Error GoTo 0
Exit Sub
SetmeRec_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure SetmeRec of Form frmReceiving"
End Sub
As usual, any help is greatly appreciated.
Many thanks in advance