UserForm DTPicker code help

Big Lar

Well-known Member
Joined
May 19, 2002
Messages
557
Sheet1 is data (values)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Sheet1 ColumnA is “Date” (format = mm/dd/yy)<o:p></o:p>
<o:p> </o:p>
UserForm2 uses two DTPicker controls to select a range of dates<o:p></o:p>
<o:p> </o:p>
I need help with the code to filter Sheet1 ColumnA based on UserForm2 selected range.

Or...is there a better solution?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Assuming that Row 1 contains the column headers, try...

Code:
[font=Verdana][color=darkblue]Private[/color] [color=darkblue]Sub[/color] CommandButton1_Click()
    [color=darkblue]With[/color] Worksheets("Sheet1").UsedRange
        .AutoFilter field:=1, Criteria1:=">=" & Me.DTPicker1.Value, Operator:=xlAnd, Criteria2:="<=" & Me.DTPicker2.Value
    [color=darkblue]End[/color] [color=darkblue]With[/color]
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[/font]

Change the control names, accordingly.
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,487
Members
452,917
Latest member
MrsMSalt

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