search button in userform

neithan

New Member
Joined
Aug 26, 2019
Messages
2
is it possible to search by date range and the result will show in textboxes without using datagrid/listbox? i have two rows of 3 textboxes first row should show only the result for the first person, and in the second row of textboxes will show only the result for second person. if date person is not in the date range the equivalent row of textboxes will be blank. i'm new in the userform. Thanks
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Private Sub cmdsearch_Click()
Dim totalrow As Long, x As Long


totalrow = Sheet3.Range("A1").CurrentRegion.Rows.Count
For currentrow = 2 To totalrow
If Trim(cmbmonth) = Trim(Cells(currentrow, 2)) And Trim(txtyear) = Trim(Cells(currentrow, 3)) And Trim(Cells(currentrow, 1) = "Bernadette") Then
lblc1bernadette = Cells(currentrow, 10)
lblc2bernadette = Cells(currentrow, 11)


If Trim(cmbmonth) = Trim(Cells(currentrow, 2)) And Trim(txtyear) = Trim(Cells(currentrow, 3)) And Trim(Cells(currentrow, 1) = "April") Then
lblc1april = Cells(currentrow, 10)
lblc2april = Cells(currentrow, 11)








End If
End If


Next currentrow
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

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