Code that selects data between a certain (specified) date range

kbishop94

Active Member
Joined
Dec 5, 2016
Messages
458
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I am creating a userform that will allow the user to select a specific date range, and then when the command button is selected, it will sort data on the worksheet that falls between the 2 dates.

I need help with the code that will be executed once the command button "cmdGetReport" is selected.

The start date and end date are captured into textboxes. "txtDateBox2" is for the start (the 'from' date) date, and "txtDateBox3" is the end (the 'to' date)

The worksheet where the data resides is named "Seatex Incident Log"

The date column where the dates are stored is in column B. The data starts on row 18 and goes down to the last row present on the worksheet (currently that is row 518.) and also goes over to the last column (which is "AG" (column 33) )

Also... I am using a datepicker for choosing the start(from) date and the end (to) that way only the same method of entering a date is used as well as ensuring that each of the dates that are chosen are placed into txtDateBox2 and txtDateBox3 in the same format and date style

Here is the (simple) form that I have so far... later I am going to be adding checkboxes that will be used for selecting specific criteria within the data that is found within the date range: (pic also shows the worksheet where the data is including column B that contains the date)

262l4ll.jpg


Thanks in advance for any help!!
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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