VBA – Open Monthview Calanedar to enter a date in a Userform textbox

wcm69

Board Regular
Joined
Dec 25, 2016
Messages
112
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 :confused:.

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 :)
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top