VBA UserForm: Filter data in between dates using sheet name (FYI: i have multiple sheets, around 20-30 of them)

wcanarejo

New Member
Joined
Jun 5, 2021
Messages
9
Hi everyone,

I am new to Excel VBA, and I have some issues filtering data in between dates.
I Just want to be able to filter entries (from date-to date) using the sheetname as a criteria.

This is how the form look like( please see attached photo)


Or if you have any way get this sorted out, please do suggest. I really need your help.
Thank you very much
 

Attachments

  • sheet viewing.PNG
    sheet viewing.PNG
    38.6 KB · Views: 4

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
10,628
Try inserting this line of code:
VBA Code:
.Parent.PrintOut
immediately below this line:
VBA Code:
.Range("A1").CurrentRegion.AutoFilter Field:=1, Criteria1:=">=" & CLng(beginDate), Operator:=xlAnd, Criteria2:="<=" & CLng(endDate)
 

Forum statistics

Threads
1,143,674
Messages
5,720,234
Members
422,271
Latest member
xbaca

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
Top