Populate Userform ListBox from a range and adding a filter

RobbieC

Active Member
Joined
Dec 14, 2016
Messages
376
Office Version
  1. 2010
Platform
  1. Windows
Hi there, I have a UserForm with a ListBox which I am populating from a Range using:

Code:
Private Sub UserForm_Initialize()
     ListBox1.RowSource = Range(Sheets("FilesInProject").Range("B2"), Sheets("FilesInProject").Range("B65536").End(xlUp)).Address(, , , True)
End sub

Which grabs everything from Sheet "FilesInProject" in column B and throws it into the ListBox in the Userform. Brilliant!

However, in column A on the same sheet I have the type of file, ie PDF, JPG, GIF etc...

What I would like to do is to be able to reload the ListBox data, but with a filter, ie. a button on the userform: 'JPG' which will load in the List from column B, but only if column A has JPG in it....

I also have, in column C, the date when the file was created 11/04/2019 (in that format)... Ultimately, I would like to create a second 'date filter' where it would search for JPG in col A and within the date range in column C... I can get a calendar to select the date ranges ('from' and 'to' in 2 seperate TextBoxes), but that's as far as I have got

If anyone can help point me in the right direction, I'd be very grateful

Thanks

Rob
 
Hi Norie, sorry to bother you, but did you have any thoughts on this filtering problem?

Regards

Rob
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,213,567
Messages
6,114,344
Members
448,570
Latest member
rik81h

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