Add datepicker to userform textbox

Adi21

Board Regular
Joined
Aug 11, 2014
Messages
62
Hello, I need some help with a datepicker. I hope somebody can help me.
I am trying to get a datepicker to appear when user clicks into a designated textbox . I would then like the user to select a date and that date to appear in the textbox. Will be two textboxs(both with datepicker) and then the code will need to copy all dates (from that interval of time) existing on a sheet from workbook.
I don`t know how to generate that datepicker when user clicks into the textbox.

I wrote a code to copy that dates, but I can`t create the datepicker ,so I`m not sure if the code is right.

Code:
DestRow = 2
For SrcRow = 2 To Sheets("Faza2").UsedRange.Rows.Count
    If DateValue(ThisWorkbook.Sheets("Faza2").Cells(SrcRow, 1)) > DateValue(UserForm1.TextBox1) And _
        DateValue(ThisWorkbook.Sheets("Faza2").Cells(SrcRow, 1)) < DateValue(UserForm1.TextBox2) And _
            ThisWorkbook.Sheets("Faza2").Cells(SrcRow, 5) = UserForm1.ComboBox1.Value Then
        ThisWorkbook.Sheets("aux").Cells(DestRow, 2) = ThisWorkbook.Sheets("Faza2").Cells(SrcRow, 1)
        ThisWorkbook.Sheets("aux").Cells(DestRow, 3) = ThisWorkbook.Sheets("Faza2").Cells(SrcRow, 11)
        DestRow = DestRow + 1
    
    
    End If
Next
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
I saw that tutorial, but there they put a calendar date picker on an Excel Worksheet, I need to put it on a TextBox of a UserForm.
Any idea?
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,816
Members
449,095
Latest member
m_smith_solihull

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