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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

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