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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,215,039
Messages
6,122,799
Members
449,095
Latest member
m_smith_solihull

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