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

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
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,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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