Calendar picker as userform

Rolly_Sefu

Board Regular
Joined
Oct 25, 2013
Messages
149
Hello

I have a Userform where people enter the a date, but sometimes they do not enter it correct.

So I found this calendar userform, witch is perfect for what I need. http://www.fontstuff.com/vba/vbatut07.htm

Just has one bug:

The month name / year from the userform is set to a particular date / year witch you can modify but only from VBA.

Is there a possibility for make this automatic, to show you the calendar of your current month ?

Thank you.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Initialize on the user form looks like this:

Code:
Private Sub UserForm_Initialize()
    If IsDate(ActiveCell.Value) Then
        Me.MonthView1.Value = ActiveCell.Value
    End If
End Sub

Change it to this:

Code:
Private Sub UserForm_Initialize()
    Me.MonthView1.Value = Date
End Sub

WBD
 
Upvote 0
Hy.

I have one more question:

Do you know in a userform how to check if I have selected a textbox ?

Because I want to make is calendar userform show when I click on the textbox.

Thanks


Initialize on the user form looks like this:

Code:
Private Sub UserForm_Initialize()
    If IsDate(ActiveCell.Value) Then
        Me.MonthView1.Value = ActiveCell.Value
    End If
End Sub

Change it to this:

Code:
Private Sub UserForm_Initialize()
    Me.MonthView1.Value = Date
End Sub

WBD
 
Upvote 0
Yep that works

I tried to solve it and I thought that the enter refers to the enter key (so I did not try this), but now I see that this is when you ENTER the textbox

Thanks a lot
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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