Listbox not showing proper data

xsmurf

Board Regular
Joined
Feb 24, 2007
Messages
55
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'am hoping to get some help here.
I have a userform that needs to show values, if some criteria is met.
please see attached file. ( extra data has been removed )

How it should work:
I fill in the clocknumber and the job is being shown => this works
then I fill in the StartDate & EndDate.
Now when I press "commandbutton1" it should show me results in the listbox => this works too.

The Problem:
It shows info that is not supposed to be there.

It should only show information that is within the criteria.
For example:
If my clocknumber=1 ( job=Painter) and my StartDate= 01/01/2023 and EndDate= 01/13/2023, it should only list all the names that match the criteria and are falling on or in between the Start/EndDate.
In this case only employee 1 / 3/ 5 should be in the list, not all the painters.

Hope someone can assist me with this problem, any help is appreciated.

Also I would not like to see double names in the list if multiple dates are found. The name should be shown once, and then the dates would need to be horizontally next to that name ( now every date is a row) .
Don't know if this is possible.

Thanks again

example file
 
@Anthony47

Quick question:
Depanding on the lenght of the names in "ws.Cells(row, 5)" & "ws.Cells(row, 4)" the data doesn't align properly.
Is there a way/option to give the "rowdata" a specific columnwidth, and the rest of the data a seperate columnwidth.
I did some testing but I guess "&vbTab" & columnwidth are not the same.

Hope you can help me out one more time.
Thank you.
 
Upvote 0
@Anthony47
it was a little tricky to finetune
The horizontal bar might not be the best when it comes to size/length, but it works for what I want.

Thank you so much for your help.
 
Upvote 0

Forum statistics

Threads
1,216,117
Messages
6,128,935
Members
449,480
Latest member
yesitisasport

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